Getting to know Ansible.

Outline


Introduction


Install

  • pip install ansible

    • pip3 install ansible
  • yum install ansible

  • apt-get install ansible

  • apk add ansible


Common modules

ping

shell / command

file

yum

systemd / service

template / copy

debug


Common modules - ping


Common modules - shell / command


Common modules - file


Common modules - yum


Common modules - systemd / service


Common modules - template / copy


Common modules - debug / register


Folder structure


Conclusion

  • 選擇適合的
    • ansible ad-hoc
      • ansible gitlab -m ping
      • ansible gitlab -m shell -a 'rm -rf /'
    • playbook
    • role
    • collection
    • shell script
    • python script
    • others