--- # tasks file for ansible - name: install ansible package: name: "{{ ansible_packages }}" state: present register: ansible_install_ansible until: ansible_install_ansible is succeeded retries: 3 - name: ensure the ansible directory exists file: path: /etc/ansible state: directory - name: mark configuration file as ansible managed lineinfile: path: "{{ ansible_configuration_directory }}/{{ ansible_configuration_file }}" create: yes insertbefore: BOF line: "# This file is managed by Ansible." - name: configure ansible ini_file: path: "{{ ansible_configuration_directory }}/{{ ansible_configuration_file }}" section: "{{ item.section | default('defaults') }}" option: "{{ item.option }}" value: "{{ item.value }}" with_items: - "{{ ansible_configuration }}" loop_control: label: "{{ item.option }}"