Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ansible_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ANSIBLE_FORCE_COLOR: 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ galaxy_info:
galaxy_tags:
- ubuntu
- jammy
- post-installation
- postinstallation
- setup
- environment
- configuration
- package
- alias

dependencies: []
dependencies: []
Original file line number Diff line number Diff line change
@@ -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
when: setup_aliases_result is failed or setup_zsh_result is failed
Original file line number Diff line number Diff line change
@@ -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
when: not setup_aliases_tasks_status
Original file line number Diff line number Diff line change
@@ -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
when: setup_zsh_result is failed
2 changes: 1 addition & 1 deletion ansible/roles/apt-fast/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ apt_fast:
MIRRORS: ""
_MAXNUM: "8"
_MAXCONPERSRV: "5"
_SPLITBUFFER: "true"
_SPLITBUFFER: "true"
4 changes: 2 additions & 2 deletions ansible/roles/apt-fast/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ galaxy_info:
galaxy_tags:
- ubuntu
- jammy
- post-installation
- postinstallation
- setup
- environment
- configuration
- package
- apt
- apt-fast
- aptfast

dependencies: []
11 changes: 5 additions & 6 deletions ansible/roles/apt-fast/tasks/add_repository.yml
Original file line number Diff line number Diff line change
@@ -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
when: add_repository_result is failed
14 changes: 6 additions & 8 deletions ansible/roles/apt-fast/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -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
when: directory_result is failed or configure_result is failed
16 changes: 7 additions & 9 deletions ansible/roles/apt-fast/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -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
when: install_result is failed and apt_install_result is failed
10 changes: 5 additions & 5 deletions ansible/roles/apt-fast/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: "Notify: apt-fast role started"
debug:
ansible.builtin.debug:
msg: "Notify: apt-fast role started"

- name: Include repository setup
Expand All @@ -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
when: not apt_fast_tasks_status