Some Vagrant fixes

Only install Dell OpenManage if not running in a VM, and fix SSH port
logic.
This commit is contained in:
Sam A. 2022-11-13 21:42:52 +01:00
parent 6a16328b7b
commit 581c832b36
Signed by: samsapti
GPG Key ID: CBBBE7371E81C4EA
6 changed files with 22 additions and 17 deletions

View File

@ -1,6 +1,6 @@
--- ---
- hosts: all - hosts: all
gather_facts: False gather_facts: false
become: true become: true
vars: vars:
base_domain: data.coop base_domain: data.coop
@ -36,6 +36,6 @@
- import_role: - import_role:
name: ubuntu_base name: ubuntu_base
tags: tags:
- base_only - base_only
- import_role: - import_role:
name: docker name: docker

View File

@ -2,6 +2,7 @@
- name: Install necessary packages via apt - name: Install necessary packages via apt
apt: apt:
name: "{{ packages }}" name: "{{ packages }}"
state: latest
vars: vars:
packages: packages:
- aptitude - aptitude
@ -9,7 +10,11 @@
- apparmor - apparmor
- haveged - haveged
- mosh - mosh
- srvadmin-all # Dell OpenManage
- name: Install Dell OpenManage
apt:
name: srvadmin-all
when: ansible_virtualization_role != "guest"
- name: Install necessary packages via pip - name: Install necessary packages via pip
pip: pip:
@ -17,6 +22,5 @@
state: latest state: latest
vars: vars:
packages: packages:
- pip # upgrade needed for docker-compose to install
- docker - docker
- docker-compose - docker-compose

View File

@ -1,15 +1,15 @@
--- ---
- name: import dell apt signing key - name: Import dell apt signing key
apt_key: apt_key:
id: "1285491434D8786F" id: "1285491434D8786F"
keyserver: "keyserver.ubuntu.com" keyserver: "keyserver.ubuntu.com"
- name: "configure dell apt repo" - name: Configure dell apt repo
apt_repository: apt_repository:
repo: "deb https://linux.dell.com/repo/community/openmanage/10101/focal focal main" repo: "deb https://linux.dell.com/repo/community/openmanage/10101/focal focal main"
state: "present" state: present
- name: "restrict dell apt repo" - name: Restrict dell apt repo"
copy: copy:
dest: "/etc/apt/preferences.d/dell" dest: "/etc/apt/preferences.d/dell"
content: | content: |
@ -17,7 +17,3 @@
Package: * Package: *
Pin: origin "linux.dell.com" Pin: origin "linux.dell.com"
Pin-Priority: 400 Pin-Priority: 400
- name: update apt cache
apt:
update_cache: yes

View File

@ -0,0 +1,3 @@
---
- name: Gather facts
gather_facts:

View File

@ -1,8 +1,11 @@
--- ---
- import_tasks: ssh.yml - import_tasks: ssh.yml
tags: [change-ssh-port] tags: [change-ssh-port]
- import_tasks: custom-apt-repos.yml - import_tasks: facts.yml
tags: [setup-custom-apt] tags: [gather-facts]
- import_tasks: dell-apt-repo.yml
tags: [setup-dell-apt-repo]
when: ansible_virtualization_role != "guest"
- import_tasks: upgrade.yml - import_tasks: upgrade.yml
tags: [do-full-system-upgrade] tags: [do-full-system-upgrade]
- import_tasks: base.yml - import_tasks: base.yml

View File

@ -2,8 +2,7 @@
- name: Check if SSH port is already configured - name: Check if SSH port is already configured
wait_for: wait_for:
port: 19022 port: 19022
state: started host: "{{ ansible_host }}"
host: "{{ inventory_hostname }}"
connect_timeout: 5 connect_timeout: 5
timeout: 10 timeout: 10
become: false become: false
@ -36,7 +35,7 @@
- name: Ensure sshd is reloaded if needed - name: Ensure sshd is reloaded if needed
meta: flush_handlers meta: flush_handlers
- name: Change ansible_port 19022 - name: Change Ansible port to 19022
set_fact: set_fact:
ansible_port: 19022 ansible_port: 19022
when: ssh_changed is defined when: ssh_changed is defined