Versions Compared

Key

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


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


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