Add Ansible linting and other stuff
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
- name: clean yum history
|
||||
become: true
|
||||
shell: |-
|
||||
ansible.builtin.shell: |-
|
||||
set -e
|
||||
yum --enablerepo=epel clean all
|
||||
yum history new
|
||||
truncate -c -s 0 /var/log/yum.log
|
||||
changed_when: false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- name: remove unnecessesary packages
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- perl
|
||||
- gcc
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- name: remove unnecessesary packages
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- make
|
||||
- perl
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
- name: clean up Fedora
|
||||
become: true
|
||||
command: dnf clean all
|
||||
ansible.builtin.command: dnf clean all # noqa command-instead-of-module
|
||||
when: ansible_facts.pkg_mgr not in ['atomic_container']
|
||||
changed_when: false
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
- name: clean apt files
|
||||
become: true
|
||||
command: apt-get clean
|
||||
ansible.builtin.command: apt-get clean # noqa command-instead-of-module
|
||||
changed_when: false
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
- become: true
|
||||
block:
|
||||
- name: install epel-release
|
||||
package:
|
||||
name: epel-release
|
||||
state: present
|
||||
|
||||
- name: disable epel
|
||||
ini_file:
|
||||
path: /etc/yum.repos.d/epel.repo
|
||||
section: epel
|
||||
option: enabled
|
||||
value: "0"
|
||||
create: false
|
||||
when: >
|
||||
ansible_facts['distribution'] in ['CentOS', 'RHEL']
|
||||
@@ -1,5 +1,5 @@
|
||||
- name: load version information
|
||||
include_vars: "{{ item }}"
|
||||
ansible.builtin.include_vars: "{{ item }}"
|
||||
loop:
|
||||
- "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml"
|
||||
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml"
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
- name: modify init file
|
||||
become: true
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
path: "{{ init_file }}"
|
||||
replace: "{{ init_replace }}"
|
||||
regexp: "{{ init_regexp }}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
- name: update locale info
|
||||
become: true
|
||||
shell: |
|
||||
set -e
|
||||
ansible.builtin.shell: |
|
||||
set -eo pipefail
|
||||
localedef --list-archive | grep -a -v en_US.utf8 | xargs sudo localedef --delete-from-archive
|
||||
cp /usr/lib/locale/locale-archive{,.tmpl}
|
||||
build-locale-archive
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- name: load vars, if needed
|
||||
include_vars: "{{ item }}"
|
||||
ansible.builtin.include_vars: "{{ item }}"
|
||||
loop:
|
||||
- "{{ role_path }}/vars/default.yml"
|
||||
- "{{ role_path }}/vars/{{ ansible_facts.distribution }}.yml"
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
- name: remove cloud-init
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: cloud-init
|
||||
state: absent
|
||||
when: ansible_facts.pkg_mgr not in ['atomic_container']
|
||||
|
||||
- name: get build time
|
||||
become: true
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
content: "{{ ansible_facts.date_time.date }}"
|
||||
dest: /etc/vagrant_box_build_time
|
||||
owner: root
|
||||
@@ -23,30 +23,30 @@
|
||||
mode: 0644
|
||||
|
||||
- name: create .ssh directory
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_user_dir }}/.ssh"
|
||||
state: directory
|
||||
mode: "0700"
|
||||
|
||||
- name: fetch authorized_keys
|
||||
get_url:
|
||||
ansible.builtin.get_url:
|
||||
mode: "0600"
|
||||
dest: "{{ ansible_user_dir }}/.ssh/authorized_keys"
|
||||
url: https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub
|
||||
|
||||
- block:
|
||||
- name: configure sshd
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
line: UseDNS no
|
||||
path: /etc/ssh/sshd_config
|
||||
|
||||
- name: check for the sshd_config.d directory
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /etc/ssh/sshd_config.d
|
||||
register: _vagrant_sshd_config_d
|
||||
|
||||
- name: be sure that sshd is configured properly to accept the pubkey
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
content: PubkeyAcceptedKeyTypes +ssh-rsa
|
||||
mode: "0600"
|
||||
owner: root
|
||||
@@ -55,7 +55,7 @@
|
||||
when: _vagrant_sshd_config_d.stat.exists
|
||||
|
||||
- name: enable sshd
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: "{{ vagrant_ssh_service_name }}"
|
||||
state: started
|
||||
enabled: true
|
||||
@@ -63,6 +63,7 @@
|
||||
# unable to determine state of the service. However, if we were able
|
||||
# to connect to it to run this Ansible, then we clearly are up
|
||||
# and running and we can safely ignore this error
|
||||
# noqa ignore-errors
|
||||
ignore_errors: >-
|
||||
{{ ansible_facts.distribution == 'Fedora' and
|
||||
ansible_facts.distribution_major_version == '31' }}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
- name: install build deps for virtualbox addons
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ virtualbox_packages }}"
|
||||
state: present
|
||||
|
||||
- name: start services
|
||||
become: true
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: true
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
- name: mount iso file
|
||||
become: true
|
||||
command: "{{ item }}"
|
||||
ansible.builtin.command: "{{ item }}"
|
||||
changed_when: false
|
||||
loop:
|
||||
- mount -o loop,ro {{ ansible_user_dir }}/VBoxGuestAdditions.iso /mnt
|
||||
@@ -22,6 +22,6 @@
|
||||
- umount /mnt
|
||||
|
||||
- name: remove iso
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
name: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso"
|
||||
state: absent
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
- name: create hgfs dir
|
||||
become: true
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
path: /mnt/hgfs
|
||||
mode: 0700
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
- name: create mount point
|
||||
become: true
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /mnt/vmware
|
||||
state: directory
|
||||
mode: 0700
|
||||
|
||||
- name: mount iso file
|
||||
become: true
|
||||
command: mount -o loop,ro {{ ansible_user_dir }}/linux.iso /mnt/vmware
|
||||
ansible.builtin.command: mount -o loop,ro {{ ansible_user_dir }}/linux.iso /mnt/vmware # noqa command-instead-of-module
|
||||
changed_when: false
|
||||
|
||||
- name: create tmp dir
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /tmp/vmware
|
||||
state: directory
|
||||
mode: 0700
|
||||
|
||||
- name: untar tools
|
||||
command: |
|
||||
ansible.builtin.command: |
|
||||
set -ex
|
||||
tar zxf /mnt/vmware/VMWareTools-*.tar.gz -C /tmp/vmware
|
||||
sudo /tmp/vmware/vmware-tools-distrib/vmware-install.pl --default --force-install
|
||||
@@ -24,7 +27,7 @@
|
||||
|
||||
- name: remove files
|
||||
become: true
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
@@ -32,7 +35,7 @@
|
||||
- "{{ ansible_user_dir }}/linux.iso"
|
||||
|
||||
- name: add content to /etc/vmware-tools/locations
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
block: |
|
||||
remove_answer ENABLE_VGAUTH
|
||||
answer ENABLE_VGAUTH no
|
||||
@@ -41,5 +44,5 @@
|
||||
|
||||
- name: finish up installs
|
||||
become: true
|
||||
command: /usr/bin/vmware-config-tools.pl --default --skip-stop-abort
|
||||
ansible.builtin.command: /usr/bin/vmware-config-tools.pl --default --skip-stop-abort
|
||||
changed_when: false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- name: read variables
|
||||
include_vars: "{{ item }}"
|
||||
ansible.builtin.include_vars: "{{ item }}"
|
||||
loop:
|
||||
- "{{ role_path }}/vars/{{ ansible_facts.distribution }}.yml"
|
||||
- "{{ role_path }}/vars/{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
|
||||
@@ -7,19 +7,19 @@
|
||||
|
||||
- name: install vmware related packages
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ vmware_packages }}"
|
||||
state: present
|
||||
|
||||
- name: modern systems
|
||||
import_tasks: has_package.yml
|
||||
ansible.builtin.import_tasks: has_package.yml
|
||||
when: >-
|
||||
ansible_distribution_name == 'fedora' or
|
||||
(ansible_distribution_name == 'debian' and
|
||||
ansible_distribution_major_version > '8')
|
||||
|
||||
- name: legacy builds
|
||||
import_tasks: legacy.yml
|
||||
ansible.builtin.import_tasks: legacy.yml
|
||||
when: >-
|
||||
(ansible_distribution_name == 'debian' and
|
||||
ansible_distribution_major_version <= '8')
|
||||
|
||||
Reference in New Issue
Block a user