diff --git a/.kitchen.yml b/.kitchen.yml index 003f5bd..4469104 100755 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -32,11 +32,9 @@ transport: username: ubuntu platforms: - - name: ubuntu-18.04 - name: ubuntu-20.04 - name: ubuntu-22.04 - driver: - image_id: ami-0515e1913cfc2801d # A private custom AMI that enables ssh-rsa keys for sshd in Vagrant. + - name: ubuntu-24.04 suites: - name: standard diff --git a/CHANGELOG.md b/CHANGELOG.md index c8f2509..eefb4ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Ansible Role - ubuntu-base: Changelog ===================================== A list of all the changes made to this repo, and the role it contains +Version 1.4.0 +------------- + +1. Added Ubuntu 24.04 support +2. Removed Ubuntu 18.04 support + Version 1.3.2 ------------- diff --git a/Gemfile b/Gemfile index d5437f3..5a76b4b 100644 --- a/Gemfile +++ b/Gemfile @@ -6,5 +6,5 @@ gem "kitchen-ec2" gem "aws-sdk-ec2" gem "kitchen-ansible" gem "kitchen-inspec" -gem "inspec" +gem "inspec", "< 6.0" gem "inspec-bin" diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..f4c3928 --- /dev/null +++ b/TODO.md @@ -0,0 +1,5 @@ +Ansible Role - ubuntu-base: TODO +===================================== +A list of all the tasks to do for this repo + +1. Restore `thefuck` for Ubuntu 24.04+ once the maintainer fixes the package. diff --git a/files/zshrc b/files/zshrc index e801a7d..eee4f0a 100644 --- a/files/zshrc +++ b/files/zshrc @@ -113,11 +113,13 @@ export EDITOR=vim # New sessions start in ~/ cd ~/ -# Make sure Vagrant uses virtualbox by default -export VAGRANT_DEFAULT_PROVIDER=virtualbox # Enable thefuck -eval "$(thefuck --alias)" +#TODO remove this if statement when the package works on 24.04+ +version=$(lsb_release -rs | grep -v "No") +if (( $(echo "$version < 24.04" | bc -l) )); then + eval "$(thefuck --alias)" +fi # Help keep repos clean by deleting branches that no longer exist upstream git_prune() diff --git a/meta/main.yml b/meta/main.yml index a0b7a5b..810c1a4 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -16,13 +16,13 @@ galaxy_info: description: "Various tweaks and basic prerequisites for Ubuntu systems along with a fancy bash prompt" company: "Route 1337 LLC" license: "license (MIT)" - min_ansible_version: "2.4" + min_ansible_version: "2.8" platforms: - name: Ubuntu versions: - - bionic - focal - jammy + - noble galaxy_tags: - base - system diff --git a/tasks/main.yml b/tasks/main.yml index 0afb6f1..1e5eb7d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -19,6 +19,6 @@ - import_tasks: ntp.yml when: ansible_distribution == 'Ubuntu' - import_tasks: thefuck.yml - when: ansible_distribution == 'Ubuntu' + when: ansible_distribution == 'Ubuntu' and ansible_distribution_version < "24.04" #TODO fix this when the package is fixed - import_tasks: systemd.yml when: ansible_distribution == 'Ubuntu' diff --git a/tasks/ntp.yml b/tasks/ntp.yml index 425eff5..48a8e39 100644 --- a/tasks/ntp.yml +++ b/tasks/ntp.yml @@ -16,6 +16,7 @@ apt: name: ntp state: present + when: ansible_distribution_version < "24.04" - name: Set localtime symlink to correct TZ set_fact: @@ -33,3 +34,4 @@ name: ntp state: started enabled: yes + when: ansible_distribution_version < "24.04" diff --git a/tasks/prereqs.yml b/tasks/prereqs.yml index da85cb4..f007033 100644 --- a/tasks/prereqs.yml +++ b/tasks/prereqs.yml @@ -52,7 +52,7 @@ - zsh - locate -- name: (Ubuntu 20.04+) Add packages +- name: Add packages apt: name: "{{ packages }}" state: present @@ -60,7 +60,6 @@ packages: - fzf - ripgrep - when: ansible_distribution_version >= "20.04" - name: Make sure the /opt directory exists file: diff --git a/tasks/thefuck.yml b/tasks/thefuck.yml index 5c00108..f7ab3ad 100644 --- a/tasks/thefuck.yml +++ b/tasks/thefuck.yml @@ -12,11 +12,18 @@ # Install thefuck, its prerequisites and our custom rules for it -- name: Install thefuck +- name: Install thefuck via pip pip: name: thefuck state: present executable: pip3 + when: ansible_distribution_version < "24.04" + +- name: Install thefuck + apt: + name: thefuck + state: present + when: ansible_distribution_version >= "24.04" - name: Create root's custom thefuck rules directory file: diff --git a/tests/host_vars/systemd/localhost.yml b/tests/host_vars/systemd/localhost.yml index 87be802..1c2a28b 100644 --- a/tests/host_vars/systemd/localhost.yml +++ b/tests/host_vars/systemd/localhost.yml @@ -17,5 +17,5 @@ ubuntu_base: - 8.8.8.8 - 1.1.1.1 search_domain: "company.internal" - tzsymlink: "EST" - localtime: "/usr/share/zoneinfo/America/New_York" + tzsymlink: "UTC" + localtime: "/usr/share/zoneinfo/UTC" diff --git a/tests/smoke/repo-role/standard/thefuck_test.rb b/tests/smoke/repo-role/standard/thefuck_test.rb deleted file mode 100644 index c459aa1..0000000 --- a/tests/smoke/repo-role/standard/thefuck_test.rb +++ /dev/null @@ -1,58 +0,0 @@ -# -# Project:: Ansible Role - ubuntu-base -# -# Copyright 2020, Route 1337 LLC, All Rights Reserved. -# -# Maintainers: -# - Matthew Ahrenstein: matthew@route1337.com -# -# See LICENSE -# - -# thefuck tests - -if os[:name] == 'ubuntu' - describe file('/root/.config/thefuck/rules') do - it { should be_directory } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - it { should be_mode 0750 } - end - - describe file('/root/.config/thefuck/rules/README.md') do - it { should exist } - end - - describe pip('thefuck', '/usr/bin/pip3') do - it { should be_installed } - end - - elsif os[:name] == 'centos' - - describe file('/root/.config/thefuck/rules') do - it { should be_directory } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - it { should be_mode 0750 } - end - - describe file('/root/.config/thefuck/rules/README.md') do - it { should exist } - end - - describe package('gcc') do - it { should be_installed } - end - - describe package('python34-pip') do - it { should be_installed } - end - - describe package('python34-devel') do - it { should be_installed } - end - - describe file('/usr/bin/thefuck') do - it { should exist } - end -end \ No newline at end of file diff --git a/tests/smoke/repo-role/systemd/ntp_test.rb b/tests/smoke/repo-role/systemd/ntp_test.rb index b4451f0..212ec7f 100644 --- a/tests/smoke/repo-role/systemd/ntp_test.rb +++ b/tests/smoke/repo-role/systemd/ntp_test.rb @@ -29,7 +29,7 @@ # Verify the localtime is set correctly # This is done via ls since each version of Ubuntu seems changes the final destination of the link describe command('ls -lh /etc/localtime') do - its('stdout') { should match /\/usr\/share\/zoneinfo\/America\/New_York/ } + its('stdout') { should match /\/usr\/share\/zoneinfo\/UTC/ } end # Verify the timezone file is correct @@ -38,12 +38,12 @@ it { should be_owned_by 'root' } it { should be_grouped_into 'root' } it { should be_mode 0644 } - its(:content) { should match /EST/ } + its(:content) { should match /UTC/ } end # Verify the time zone we want is active describe command('date +%Z') do - its('stdout') { should match /EST/ } + its('stdout') { should match /UTC/ } end # Verify the ntp service is running and enabled diff --git a/tests/smoke/repo-role/systemd/thefuck_test.rb b/tests/smoke/repo-role/systemd/thefuck_test.rb deleted file mode 100644 index c459aa1..0000000 --- a/tests/smoke/repo-role/systemd/thefuck_test.rb +++ /dev/null @@ -1,58 +0,0 @@ -# -# Project:: Ansible Role - ubuntu-base -# -# Copyright 2020, Route 1337 LLC, All Rights Reserved. -# -# Maintainers: -# - Matthew Ahrenstein: matthew@route1337.com -# -# See LICENSE -# - -# thefuck tests - -if os[:name] == 'ubuntu' - describe file('/root/.config/thefuck/rules') do - it { should be_directory } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - it { should be_mode 0750 } - end - - describe file('/root/.config/thefuck/rules/README.md') do - it { should exist } - end - - describe pip('thefuck', '/usr/bin/pip3') do - it { should be_installed } - end - - elsif os[:name] == 'centos' - - describe file('/root/.config/thefuck/rules') do - it { should be_directory } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - it { should be_mode 0750 } - end - - describe file('/root/.config/thefuck/rules/README.md') do - it { should exist } - end - - describe package('gcc') do - it { should be_installed } - end - - describe package('python34-pip') do - it { should be_installed } - end - - describe package('python34-devel') do - it { should be_installed } - end - - describe file('/usr/bin/thefuck') do - it { should exist } - end -end \ No newline at end of file