To jump straight to it - this collection is useful for you if you want to manage the configuration of your SONiC switch(es) via Ansible.
An example says more than a thousand words, so here is an example:
# set_port_play.yml
---
- name: Connect to a SONiC swich and set properties on a port
hosts: sonic-sw1.example.com
gather_facts: false
tasks:
- name: Set port description
community.sonic.sonic_interface_port:
interface: qsfp1
description: This is the uplink
speed: 100G
fec: rs
enabled: True
# inventory.ini
[my_sonic_switches]
sonic-sw1.example.com ansible_user=sonic ansible_password=password
$ ansible-playbook -i inventory.ini set_port_play.yml
We follow the Ansible Code of Conduct in all our interactions within this project.
If you encounter abusive behavior, please refer to the policy violations section of the Code for information on how to raise a complaint.
We mostly hang out in the SONiC Community Matrix room and on the sonic-dev mailinglist.
The content of this collection is made by people like you, a community of individuals collaborating on making the world better through developing automation software.
We are actively accepting new contributors.
Any kind of contribution is very welcome.
You don't know how to start? Refer to our contribution guide!
We use the following guidelines:
- CONTRIBUTING.md
- REVIEW_CHECKLIST.md
- Ansible Community Guide
- Ansible Development Guide
- Ansible Collection Development Guide
When developing new features you will want to run the tests to ensure things are working as they should.
To run the unit and sanity tests:
$ ansible-test units --docker
$ ansible-test sanity --docker
To run the full integration suite using a virtual SONiC switch:
$ docker build -t testbed -f testbed/Dockerfile testbed
$ docker run --device /dev/kvm -ti -w /work/ansible_collections/community/sonic \
-v $PWD:/work/ansible_collections/community/sonic --user 1000:1000 testbed /docker.sh
The current maintainers are listed in the MAINTAINERS file. If you have questions or need help, feel free to mention them in the proposals.
To learn how to maintain / become a maintainer of this collection, refer to the Maintainer guidelines.
The process of decision making in this collection is based on discussing and finding consensus among participants.
Every voice is important. If you have something on your mind, create an issue or dedicated discussion and let's discuss it!
- Ansible 2.14
- Ansible 2.15
- Ansible 2.16
- Release 202211
- Only SSH connections supported
Before using this collection, you need to install it with the Ansible Galaxy command-line tool:
ansible-galaxy collection install community.sonic
You can also include it in a requirements.yml
file and install it with ansible-galaxy collection install -r requirements.yml
, using the format:
---
collections:
- name: community.sonic
Note that if you install the collection from Ansible Galaxy, it will not be upgraded automatically when you upgrade the ansible
package.
To upgrade the collection to the latest available version, run the following command:
$ ansible-galaxy collection install community.sonic --upgrade
You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version 0.1.0
:
$ ansible-galaxy collection install community.sonic:==0.1.0
See Ansible Using collections for more details.
See the changelog.
GNU General Public License v3.0 or later.
See LICENSE to see the full text.