diff --git a/.github/workflows/ansible_test.yml b/.github/workflows/ansible_test.yml new file mode 100644 index 0000000..50f71ea --- /dev/null +++ b/.github/workflows/ansible_test.yml @@ -0,0 +1 @@ + ANSIBLE_FORCE_COLOR: 1 diff --git a/ansible/roles/aliases/defaults/main.yml b/ansible/roles/aliases/defaults/main.yaml similarity index 100% rename from ansible/roles/aliases/defaults/main.yml rename to ansible/roles/aliases/defaults/main.yaml diff --git a/ansible/roles/aliases/meta/main.yml b/ansible/roles/aliases/meta/main.yaml similarity index 90% rename from ansible/roles/aliases/meta/main.yml rename to ansible/roles/aliases/meta/main.yaml index 313b163..472e780 100644 --- a/ansible/roles/aliases/meta/main.yml +++ b/ansible/roles/aliases/meta/main.yaml @@ -12,11 +12,11 @@ galaxy_info: galaxy_tags: - ubuntu - jammy - - post-installation + - postinstallation - setup - environment - configuration - package - alias -dependencies: [] \ No newline at end of file +dependencies: [] diff --git a/ansible/roles/aliases/tasks/main.yml b/ansible/roles/aliases/tasks/main.yaml similarity index 65% rename from ansible/roles/aliases/tasks/main.yml rename to ansible/roles/aliases/tasks/main.yaml index 53e360b..5b37824 100644 --- a/ansible/roles/aliases/tasks/main.yml +++ b/ansible/roles/aliases/tasks/main.yaml @@ -1,25 +1,24 @@ --- - name: "Notify: alias role started" - debug: + ansible.builtin.debug: msg: "Notify: alias role started" -- name: Настраиваем алиасы для всех пользователей - include_tasks: setup_aliases.yml +- name: "Configure for all users" + ansible.builtin.include_tasks: setup_aliases.yml register: setup_aliases_result ignore_errors: true -- name: Настраиваем ZSH (если включено) - include_tasks: setup_zsh.yml +- name: "Configure ZSH" + ansible.builtin.include_tasks: setup_zsh.yml when: enable_zsh register: setup_zsh_result - ignore_errors: true - name: "Notify: alias role finished" - debug: + ansible.builtin.debug: msg: "Notify: alias role finished" when: setup_aliases_result is not failed and setup_zsh_result is not failed - name: "Notify: alias role finished with failure" - debug: + ansible.builtin.debug: msg: "Notify: alias role finished with failure" - when: setup_aliases_result is failed or setup_zsh_result is failed \ No newline at end of file + when: setup_aliases_result is failed or setup_zsh_result is failed diff --git a/ansible/roles/aliases/tasks/setup_aliases.yml b/ansible/roles/aliases/tasks/setup_aliases.yaml similarity index 72% rename from ansible/roles/aliases/tasks/setup_aliases.yml rename to ansible/roles/aliases/tasks/setup_aliases.yaml index f7e8cc4..7bbfe2e 100644 --- a/ansible/roles/aliases/tasks/setup_aliases.yml +++ b/ansible/roles/aliases/tasks/setup_aliases.yaml @@ -1,48 +1,46 @@ --- - name: "Notify: setup_aliases role started" - debug: + ansible.builtin.debug: msg: "Notify: setup_aliases role started" -- name: Create directory for global aliases - file: +- name: "Create directory for global aliases" + ansible.builtin.file: path: /etc/profile.d state: directory mode: '0755' - become: true register: profile_dir_result -- name: Maked global aliases - template: +- name: "Maked global aliases" + ansible.builtin.template: src: bash_aliases.j2 dest: /etc/profile.d/custom_aliases.sh mode: '0644' - become: true register: bash_aliases_result when: profile_dir is not failed -- name: Update .bashrc for all users - blockinfile: +- name: "Update .bashrc for all users" + ansible.builtin.blockinfile: path: "{{ ansible_user_dir }}/.bashrc" block: | if [ -f /etc/profile.d/custom_aliases.sh ]; then . /etc/profile.d/custom_aliases.sh fi marker: "# {mark} ANSIBLE MANAGED BLOCK - CUSTOM ALIASES" - create: yes - become: true + create: true + mode: '0664' register: bashrc_update_result when: bash_aliases is not failed -- name: Set task status - set_fact: +- name: "Set task status" + ansible.builtin.set_fact: setup_aliases_tasks_status: "{{ profile_dir_result is not failed and bash_aliases_result is not failed and bashrc_update_result is not failed }}" - name: "Notify: setup_aliases role finished" - debug: + ansible.builtin.debug: msg: "Notify: setup_aliases role finished" when: setup_aliases_tasks_status - name: "Notify: setup_aliases role finished with failure" - debug: + ansible.builtin.debug: msg: "Notify: setup_aliases role finished with failure" - when: not setup_aliases_tasks_status \ No newline at end of file + when: not setup_aliases_tasks_status diff --git a/ansible/roles/aliases/tasks/setup_zsh.yml b/ansible/roles/aliases/tasks/setup_zsh.yaml similarity index 69% rename from ansible/roles/aliases/tasks/setup_zsh.yml rename to ansible/roles/aliases/tasks/setup_zsh.yaml index 1bf1f4e..3159153 100644 --- a/ansible/roles/aliases/tasks/setup_zsh.yml +++ b/ansible/roles/aliases/tasks/setup_zsh.yaml @@ -1,30 +1,31 @@ --- - name: "Notify: setup_zsh role started" - debug: + ansible.builtin.debug: msg: "Notify: setup_zsh role started" -- name: Configure ZSH +- name: "Configure ZSH block" + when: enable_zsh block: - name: Append alias in to .zshrc - template: + ansible.builtin.template: src: zsh_aliases.j2 dest: "{{ ansible_user_dir }}/{{ item }}" mode: '0644' loop: "{{ zsh_config_files }}" - - name: Enable ZSH - user: + - name: "Enable ZSH" + ansible.builtin.user: name: "{{ ansible_user_id }}" shell: /bin/zsh - when: enable_zsh - register: setup_zsh_result + register: setup_zsh_result + - name: "Notify: setup_zsh role finished" - debug: + ansible.builtin.debug: msg: "Notify: setup_zsh role finished" when: setup_zsh_result is not failed - name: "Notify: setup_zsh role finished with failure" - debug: + ansible.builtin.debug: msg: "Notify: setup_zsh role finished with failure" - when: setup_zsh_result is failed \ No newline at end of file + when: setup_zsh_result is failed diff --git a/ansible/roles/apt-fast/defaults/main.yml b/ansible/roles/apt-fast/defaults/main.yml index 078bc82..98e6b2c 100644 --- a/ansible/roles/apt-fast/defaults/main.yml +++ b/ansible/roles/apt-fast/defaults/main.yml @@ -8,4 +8,4 @@ apt_fast: MIRRORS: "" _MAXNUM: "8" _MAXCONPERSRV: "5" - _SPLITBUFFER: "true" \ No newline at end of file + _SPLITBUFFER: "true" diff --git a/ansible/roles/apt-fast/meta/main.yml b/ansible/roles/apt-fast/meta/main.yml index 950b3d3..338d431 100644 --- a/ansible/roles/apt-fast/meta/main.yml +++ b/ansible/roles/apt-fast/meta/main.yml @@ -12,12 +12,12 @@ galaxy_info: galaxy_tags: - ubuntu - jammy - - post-installation + - postinstallation - setup - environment - configuration - package - apt - - apt-fast + - aptfast dependencies: [] diff --git a/ansible/roles/apt-fast/tasks/add_repository.yml b/ansible/roles/apt-fast/tasks/add_repository.yml index b4fcc8c..8f7e1e8 100644 --- a/ansible/roles/apt-fast/tasks/add_repository.yml +++ b/ansible/roles/apt-fast/tasks/add_repository.yml @@ -1,22 +1,21 @@ --- - name: "Notify: add_repository role started" - debug: + ansible.builtin.debug: msg: "Notify: add_repository role started" -- name: Add apt-fast PPA repository +- name: "Add apt-fast PPA repository" ansible.builtin.apt_repository: repo: "{{ apt_fast.repo }}" state: present - become: true tags: apt-fast-repo register: add_repository_result - name: "Notify: add_repository role finished" - debug: + ansible.builtin.debug: msg: "Notify: add_repository role finished" when: add_repository_result is not failed - name: "Notify: add_repository role finished with failure" - debug: + ansible.builtin.debug: msg: "Notify: add_repository role finished with failure" - when: add_repository_result is failed \ No newline at end of file + when: add_repository_result is failed diff --git a/ansible/roles/apt-fast/tasks/configure.yml b/ansible/roles/apt-fast/tasks/configure.yml index 5a8def0..b3c2f77 100644 --- a/ansible/roles/apt-fast/tasks/configure.yml +++ b/ansible/roles/apt-fast/tasks/configure.yml @@ -1,34 +1,32 @@ --- - name: "Notify: configure role started" - debug: + ansible.builtin.debug: msg: "Notify: configure role started" -- name: Ensure config directory exists +- name: "Ensure config directory exists" ansible.builtin.file: path: /etc/apt-fast state: directory mode: '0755' - become: true tags: apt-fast-config register: directory_result ignore_errors: true -- name: Configure apt-fast +- name: "Configure apt-fast" ansible.builtin.template: src: apt-fast.conf.j2 dest: /etc/apt-fast.conf mode: '0644' - become: true tags: apt-fast-config register: configure_result ignore_errors: true - name: "Notify: configure role finished" - debug: + ansible.builtin.debug: msg: "Notify: configure role finished" when: directory_result is not failed and configure_result is not failed - name: "Notify: configure role finished with failure" - debug: + ansible.builtin.debug: msg: "Notify: configure role finished with failure" - when: directory_result is failed or configure_result is failed \ No newline at end of file + when: directory_result is failed or configure_result is failed diff --git a/ansible/roles/apt-fast/tasks/install.yml b/ansible/roles/apt-fast/tasks/install.yml index 39d7826..b9b90a4 100644 --- a/ansible/roles/apt-fast/tasks/install.yml +++ b/ansible/roles/apt-fast/tasks/install.yml @@ -1,32 +1,30 @@ --- - name: "Notify: install role started" - debug: + ansible.builtin.debug: msg: "Notify: install role started" -- name: Update apt cache +- name: "Update apt cache" ansible.builtin.apt: - update_cache: yes - become: true + update_cache: true tags: apt-fast-install ignore_errors: true register: install_result -- name: Install apt-fast package +- name: "Install apt-fast package" ansible.builtin.apt: name: "{{ apt_fast.packages }}" state: present - become: true tags: apt-fast-install register: apt_install_result ignore_errors: true when: install_result is not failed - name: "Notify: install role finished" - debug: + ansible.builtin.debug: msg: "Notify: install role finished" when: install_result is not failed and apt_install_result is not failed - name: "Notify: install role finished with failure" - debug: + ansible.builtin.debug: msg: "Notify: install role finished with failure" - when: install_result is failed and apt_install_result is failed \ No newline at end of file + when: install_result is failed and apt_install_result is failed diff --git a/ansible/roles/apt-fast/tasks/main.yml b/ansible/roles/apt-fast/tasks/main.yml index a9d1dcb..d8b0a99 100644 --- a/ansible/roles/apt-fast/tasks/main.yml +++ b/ansible/roles/apt-fast/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: "Notify: apt-fast role started" - debug: + ansible.builtin.debug: msg: "Notify: apt-fast role started" - name: Include repository setup @@ -18,15 +18,15 @@ when: installation_result is not failed - name: Set task status - set_fact: + ansible.builtin.set_fact: apt_fast_tasks_status: "{{ include_repository_result is not failed and installation_result is not failed and configuration_result is not failed }}" - name: "Notify: apt-fast role finished" - debug: + ansible.builtin.debug: msg: "Notify: apt-fast role finished" when: apt_fast_tasks_status - name: "Notify: apt-fast role finished with failure" - debug: + ansible.builtin.debug: msg: "Notify: apt-fast role finished with failure" - when: not apt_fast_tasks_status \ No newline at end of file + when: not apt_fast_tasks_status