diff --git a/ansible.cfg b/ansible.cfg index 959facc8..a42d25e8 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -4,6 +4,7 @@ inventory = inventory callback_result_format = yaml remote_tmp = ~/.ansible/tmp host_key_checking = false +executable = /bin/bash [ssh_connection] pipelining = True diff --git a/default.ubuntu.config.yml b/default.ubuntu.config.yml new file mode 100644 index 00000000..a8aede88 --- /dev/null +++ b/default.ubuntu.config.yml @@ -0,0 +1,45 @@ +--- +# APT Installed Packages +# List of packages to be installed via apt. +apt_installed_packages: + - git + - build-essential + - cmake + - gdb + - lcov + - pkg-config + - libbz2-dev + - libffi-dev + - libgdbm-dev + - libgdbm-compat-dev + - liblzma-dev + - libncurses5-dev + - libreadline6-dev + - libsqlite3-dev + - libssl-dev + - lzma + - tk-dev + - uuid-dev + - zlib1g-dev + - libmpdec-dev + - libzstd-dev + - inetutils-inetd + - dkms + - xz-utils + - pipx + - luarocks + - neovim + - tmux + - htop + - duf + - bat + - fish + - btop + +# Installed Applications from the App Center +# List of applications to install from the App Center. +snap_installed_apps: + - firefox + - name: alacritty + classic: true + - steam diff --git a/playbooks/main.yml b/playbooks/main.yml index 94529a28..c5c20e11 100644 --- a/playbooks/main.yml +++ b/playbooks/main.yml @@ -1,3 +1,5 @@ --- - name: Import macosx playbook ansible.builtin.import_playbook: macos.yml +- name: Import ubuntu playbook + ansible.builtin.import_playbook: ubuntu.yml diff --git a/playbooks/ubuntu.yml b/playbooks/ubuntu.yml new file mode 100644 index 00000000..99d17f25 --- /dev/null +++ b/playbooks/ubuntu.yml @@ -0,0 +1,65 @@ +--- +- name: Ubuntu Playbook + hosts: ubuntu + + vars_files: + - ../default.ubuntu.config.yml + + pre_tasks: + - name: Include config override file, if it exists + ansible.builtin.include_vars: "{{ item }}" + with_fileglob: + - ../ubuntu.config.yml + tags: ['always'] + + - name: Update apt cache if needed + ansible.builtin.apt: + update_cache: true + cache_valid_time: 86400 + tags: [init] + become: true + + - name: Upgrade the OS + ansible.builtin.apt: + upgrade: safe + tags: [init] + become: true + + - name: Update all packages to their latest version + ansible.builtin.apt: + name: "*" + state: latest # noqa package-latest + tags: [init] + become: true + + - name: Remove dependencies that are no longer required and purge their configuration files + ansible.builtin.apt: + autoremove: yes + purge: true + tags: [init] + become: true + + - name: Run the equivalent of "apt-get clean" as a separate step + ansible.builtin.apt: + clean: yes + tags: [init] + become: true + + tasks: + + - name: Install APT packages + ansible.builtin.apt: + name: "{{ item.name | default(item) }}" + state: present + become: yes + tags: [apt] + loop: "{{ apt_installed_packages }}" + + - name: Install Applications from the App Center + community.general.snap: + name: "{{ item.name | default(item) }}" + classic: "{{ item.classic | default(false) }}" + state: present + become: yes + tags: [snap] + loop: "{{ snap_installed_apps }}" diff --git a/requirements.yml b/requirements.yml index f5a39be7..730ee268 100644 --- a/requirements.yml +++ b/requirements.yml @@ -6,5 +6,7 @@ roles: collections: - name: geerlingguy.mac version: 4.1.0 + - name: community.general + version: 12.6.0 - source: ../dev-setup type: dir