Ansible
The architecture of an environment managed by Ansible features several concepts:
- Controller host which contains playbooks which are executed
- Managed hosts which are controlled using SSH
Tasks
Hello, World!
---
- name: Hello, World! playbook
  hosts: all
  tasks:
  - name: Hello, World! play
    command: echo Hello, World!
... # (1)
- Ad-hocansible all -m command -a "echo Hello, World!"
Configuration
- 
ansible.cfg[privilege_escalation] become=yes become_method=sudo become_user=root become_ask_pass=no remote_user=ansible [defaults] interpreter_python=auto_silent deprecation_warnings=FalseDisplay non-default settingsansible-config dump --only-changed
Documentation
- 
ansible-doc# List currently installed modules ansible-doc -l # Get module-specific information ansible-doc $MODULE # Get example code ansible-doc -s $MODULEVerify YAML syntaxansible-playbook --syntax-check $FILE
Files
- 
Create file--- - name: Create file hosts: all tasks: - name: Create file copy: dest: /etc/motd content: "Hello, World!\n" # (1) ...- Alma Linux 9 requires an additional package to be installed to handle SELinux contexts:
# This package is incorrectly identified as "libselinux-python" in the Ansible error displayed on the controller host dnf install python3-libselinux
 Delete file--- - name: Delete file hosts: all tasks: - name: Delete file file: path: /etc/motd state: absent ...
- Alma Linux 9 requires an additional package to be installed to handle SELinux contexts: