Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#Installing Ansible
1. git clone https://github.com/ansible/ansible
2. cd ansible
3. git checkout v2.0.0.2-1 -b v2.0.0.2-1
4. git submodule update --init --recursive
5. make
6. sudo make install

Note: v2.0.0.2 is the currently tested Ansible version. Other versions may not work correctly.


#How to use this Ansible sample playbook to deploy SONiC:

1. Prepare a switch with the SONiC base image. See: https://github.com/Azure/SONiC/blob/gh-pages/quickstart.md
Expand All @@ -9,6 +20,7 @@
* apt_repo_ip = The ip address (or FQDN) of your APT mirror, typically private.
* [ntp,syslog,dns]_servers = A list of your server IPs for these services.
* snmp_rocommunity = your internal snmp community string.
* Replace sonicadmin_user and ansible_ssh_user with the username you built into the baseimage
4. Update vars/docker_registry.yml:
* docker_registry_host = FQDN:port of your docker registry
* docker_registry_username = username of your docker registry
Expand Down
7 changes: 4 additions & 3 deletions ansible/group_vars/sonic/vars
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ansible_ssh_user: acsadmin
ansible_ssh_user: admin
ansible_ssh_pass: password
ansible_become_pass: password
acsadmin_password: password
acsadmin_initial_password: 123456
sonicadmin_user: admin
sonicadmin_password: password
sonicadmin_initial_password: 123456

sonic_version: "v2"

Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/sonic-common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
when: sonic_hwsku in mellanox_hwskus
tags: always

- name: update acsadmin password
- name: update sonicadmin password
include: passwd.yml
tags: system

Expand Down
6 changes: 3 additions & 3 deletions ansible/roles/sonic-common/tasks/passwd.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
- block:
- name: setup bootstrap password
set_fact: ansible_ssh_pass={{ acsadmin_initial_password }} ansible_become_pass={{ acsadmin_initial_password }}
set_fact: ansible_ssh_pass={{ sonicadmin_initial_password }} ansible_become_pass={{ sonicadmin_initial_password }}

- name: setup local user
become: yes
user: name={{ ansible_ssh_user }} password={{ acsadmin_password|password_hash('sha512', 'acs') }}
user: name={{ ansible_ssh_user }} password={{ sonicadmin_password|password_hash('sha512', 'acs') }}

# End block
when: bootstrap is defined

- name: setup normal password
set_fact: ansible_ssh_pass={{ acsadmin_password }} ansible_become_pass={{ acsadmin_password }}
set_fact: ansible_ssh_pass={{ sonicadmin_password }} ansible_become_pass={{ sonicadmin_password }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Requires=docker.service
After=docker.service

[Service]
User=acsadmin
User={{ sonicadmin_user }}
ExecStart=/usr/bin/docker start -a database
ExecStop=/usr/bin/docker stop database

Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion ansible/roles/sonicv2/templates/etc/systemd/system/bgp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Requires=database.service
After=database.service

[Service]
User=acsadmin
User={{ sonicadmin_user }}
ExecStart=/usr/bin/docker start -a bgp
ExecStop=/usr/bin/docker stop bgp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Requires=database.service
After=database.service

[Service]
User=acsadmin
User={{ sonicadmin_user }}
ExecStart=/usr/bin/docker start -a orchagent
ExecStop=/usr/bin/docker stop orchagent
ExecStopPost=/usr/bin/docker stop syncd
Expand Down