Packer.Images/ansible/roles/os/tasks/packages.yml

69 lines
1.6 KiB
YAML
Raw Normal View History

2022-10-10 14:05:48 +00:00
- name: Configure 'needrestart' package
ansible.builtin.lineinfile:
path: /etc/needrestart/needrestart.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
loop:
- regexp: "^#\\$nrconf\\{restart\\} = 'i';"
line: "$nrconf{restart} = 'a';"
- regexp: "^#\\$nrconf\\{kernelhints\\} = -1;"
line: "$nrconf{kernelhints} = -1;"
2022-11-07 01:18:54 +00:00
loop_control:
label: "{{ item.line }}"
2022-10-10 14:05:48 +00:00
2021-06-08 19:27:08 +00:00
- name: Install additional packages
ansible.builtin.apt:
2022-08-03 11:53:54 +00:00
pkg: "{{ packages.apt }}"
2021-06-08 19:27:08 +00:00
state: latest
update_cache: yes
install_recommends: no
2022-06-25 06:49:53 +00:00
2021-06-08 19:56:06 +00:00
- name: Upgrade all packages
ansible.builtin.apt:
name: '*'
2021-06-08 19:56:06 +00:00
state: latest
update_cache: yes
2022-06-25 06:49:53 +00:00
2022-08-03 11:53:54 +00:00
- name: Install additional python packages
ansible.builtin.pip:
2022-08-03 12:39:36 +00:00
name: "{{ item }}"
executable: pip3
2022-08-03 11:53:54 +00:00
state: latest
2022-08-03 12:39:36 +00:00
loop: "{{ packages.pip }}"
2022-08-03 11:53:54 +00:00
2022-11-29 13:32:44 +00:00
- name: Create folder
ansible.builtin.file:
path: /etc/ansible
state: directory
- name: Configure Ansible defaults
2024-06-11 02:00:08 +00:00
ansible.builtin.copy:
2022-11-29 13:32:44 +00:00
dest: /etc/ansible/ansible.cfg
content: |
[defaults]
callbacks_enabled = ansible.posix.profile_tasks
force_color = true
stdout_callback = community.general.diy
[callback_diy]
[callback_profile_tasks]
task_output_limit = 0
- name: Create default shell aliases
ansible.builtin.lineinfile:
path: ~/.bashrc
state: present
line: "{{ item }}"
insertafter: EOF
loop:
- alias k="kubectl"
- alias less="less -rf"
loop_control:
label: "{{ (item | regex_findall('([^ =\"]+)'))[2] }}"
2022-11-29 13:32:44 +00:00
2021-06-08 19:56:06 +00:00
- name: Cleanup
ansible.builtin.apt:
autoremove: yes
2021-06-11 12:44:43 +00:00
purge: yes