--- # tasks file for ansible - name: import assert.yml ansible.builtin.import_tasks: assert.yml run_once: yes delegate_to: localhost - name: install ansible block: - name: install ansible package (allowed to fail) ansible.builtin.package: name: "{{ ansible_packages }}" state: present rescue: - name: install ansible pip ansible.builtin.pip: name: ansible state: present - name: ensure the ansible directory exists ansible.builtin.file: path: "{{ ansible_configuration_directory }}" state: directory mode: "0755" - name: mark configuration file as ansible managed ansible.builtin.lineinfile: path: "{{ ansible_configuration_directory }}/{{ ansible_configuration_file }}" create: yes insertbefore: BOF line: "# This file is managed by Ansible." mode: "0644" - name: configure ansible community.general.ini_file: path: "{{ ansible_configuration_directory }}/{{ ansible_configuration_file }}" section: "{{ item.section | default('defaults') }}" option: "{{ item.option }}" value: "{{ item.value }}" mode: "0644" loop: "{{ ansible_configuration }}" loop_control: label: "{{ item.option }}"