Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

https://docs.ipinfusion.com/service-provider/#page/OcNOS-SP/Ansible-Overview.html

https://github.com/IPInfusion/ocnos-ansible-collection

https://docs.ipinfusion.com/service-provider/index.html#context/Ansible-82c0dea0-6287-466e-bbcb-ab8932ea3936

https://github.com/IPInfusion/OcNOS/tree/master/ansible

https://github.com/IPInfusion/OcNOS/blob/master/ansible/roles/leaf/templates/leaf.j2


Basic
hosts file


Code Block
titlehosts
root@ansible /etc/ansible# more /etc/ansible/hosts
. . .

[vpls]
192.168.0
.201 192.168.0.202 192.168.0.203 192.168.0.204 pingansible vpls -m ping -u ocnos -k
.143 ansible_ssh_user=ocnos ansible_ssh_pass=ocnos


ping

ansible <group-name-in-hosts> -m ping -u ocnos -k

or

ansible  vpls -m ping


Image Addedmore

ansible-galaxycreate a directory architecture
vpls is the name of the project

ansible-galaxy init vpls

tree vpls


Code Block
titleansible-galaxy init XXXX
collapsetrue
root@ansible /etc/ansible# ansible-galaxy init vpls
- Role vpls was created successfully
root@ansible /etc/ansible# tree vpls/
vpls/
|-- README.md
|-- defaults
|   `-- main.yml
|-- files
|-- handlers
|   `-- main.yml
|-- meta
|   `-- main.yml
|-- tasks
|   `-- main.yml
|-- templates
|-- tests
|   |-- inventory
|   `-- test.yml
`-- vars
    `-- main.yml

8 directories, 8 files


important files

tasks/main.yml

templates/    (jinja2 files )

tests/inventory




https://docs.ipinfusion.com/service-provider/#page/OcNOS-SP/Ansible-Overview.html#ww519239

ansible --version

Code Block
titleansible
collapsetrue
root@ansible /etc/ansible# ansible --version
ansible 2.10.17
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/library', '/usr/share/ansible/library']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]


install ocnos module

/bin/python3 -m pip install --upgrade pip

pip list
pip install paramiko
pip install ansible-pylibssh
ansible-galaxy collection install ipinfusion.ocnos


( if you have the file:    ansible-galaxy collection install ipinfusion-ocnos-x.x.x.tar.gz   )