xxxxxxxxxx
# For more examples see https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html
# You can also use the 'args' form to provide the options.
- name: This command will change the working directory to somedir/ and will only run when somedir/somelog.txt doesn't exist
ansible.builtin.shell: somescript.sh >> somelog.txt
args:
chdir: somedir/
creates: somelog.txt
xxxxxxxxxx
- name: install ntpdate
package:
name: ntpdate
state: present
# This uses a variable as this changes per distribution.
- name: remove the apache package
package:
name: "{{ apache }}"
state: absent
- name: install the latest version of Apache and MariaDB
package:
name:
- httpd
- mariadb-server
state: latest