From d87b43d6597c7cb247a132e56f03b2ce8700fca4 Mon Sep 17 00:00:00 2001 From: Christian Wagner Date: Thu, 9 Apr 2020 02:43:31 +0800 Subject: [PATCH] changes for openbsd --- openbsd-6.5-x86_64-proxmox/README.md | 2 +- .../openbsd-6.5-x86_64-proxmox.json | 6 +++--- openbsd-6.5-x86_64-proxmox/playbook/ansible.cfg | 1 + openbsd-6.5-x86_64-proxmox/playbook/hosts | 3 +++ .../playbook/requirements.yml | 2 +- .../playbook/server-template.yml | 17 +++++++++++++++++ 6 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 openbsd-6.5-x86_64-proxmox/playbook/hosts diff --git a/openbsd-6.5-x86_64-proxmox/README.md b/openbsd-6.5-x86_64-proxmox/README.md index 3097cf4..5222868 100644 --- a/openbsd-6.5-x86_64-proxmox/README.md +++ b/openbsd-6.5-x86_64-proxmox/README.md @@ -30,7 +30,7 @@ packer --version - [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) 2.7.10 ``` -apt -y install python3-pip +apt -y install python3-pip sshpass pip3 install ansible==2.7.10 ``` diff --git a/openbsd-6.5-x86_64-proxmox/openbsd-6.5-x86_64-proxmox.json b/openbsd-6.5-x86_64-proxmox/openbsd-6.5-x86_64-proxmox.json index f452441..9ab5411 100644 --- a/openbsd-6.5-x86_64-proxmox/openbsd-6.5-x86_64-proxmox.json +++ b/openbsd-6.5-x86_64-proxmox/openbsd-6.5-x86_64-proxmox.json @@ -38,7 +38,7 @@ "template_description":"{{user `template_description`}}", "memory": "{{user `vm_memory`}}", "cores": "2", - "os": "l26", + "os": "other", "http_directory": "http", "node": "proxmox", @@ -60,14 +60,14 @@ "ssh_username": "{{user `ssh_username`}}", "ssh_password": "{{user `ssh_password`}}", "ssh_timeout": "15m", - "ssh_host": "10.10.10.55", + "ssh_host": "10.10.10.230", "qemu_agent": false, "iso_file": "local:iso/{{user `iso_filename`}}", "unmount_iso": true, "boot_wait": "30s", "boot_command": [ "a", - "", + "", "http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.conf", "", "i" diff --git a/openbsd-6.5-x86_64-proxmox/playbook/ansible.cfg b/openbsd-6.5-x86_64-proxmox/playbook/ansible.cfg index 99093a4..5999559 100644 --- a/openbsd-6.5-x86_64-proxmox/playbook/ansible.cfg +++ b/openbsd-6.5-x86_64-proxmox/playbook/ansible.cfg @@ -5,3 +5,4 @@ callback_whitelist = timer, profile_roles stdout_callback = yaml roles_path = ./roles log_path = ./logs/server-template.log +inventory = ./hosts diff --git a/openbsd-6.5-x86_64-proxmox/playbook/hosts b/openbsd-6.5-x86_64-proxmox/playbook/hosts new file mode 100644 index 0000000..e11915f --- /dev/null +++ b/openbsd-6.5-x86_64-proxmox/playbook/hosts @@ -0,0 +1,3 @@ +[servers] + +OpenBSD ansible_host=10.10.10.230 ansible_port=22 diff --git a/openbsd-6.5-x86_64-proxmox/playbook/requirements.yml b/openbsd-6.5-x86_64-proxmox/playbook/requirements.yml index 7590ecb..acc1745 100644 --- a/openbsd-6.5-x86_64-proxmox/playbook/requirements.yml +++ b/openbsd-6.5-x86_64-proxmox/playbook/requirements.yml @@ -1,2 +1,2 @@ - src: https://github.com/chriswayg/ansible-initial-server.git - version: v1.4 + #version: v1.4 diff --git a/openbsd-6.5-x86_64-proxmox/playbook/server-template.yml b/openbsd-6.5-x86_64-proxmox/playbook/server-template.yml index e7e71a7..09ad780 100644 --- a/openbsd-6.5-x86_64-proxmox/playbook/server-template.yml +++ b/openbsd-6.5-x86_64-proxmox/playbook/server-template.yml @@ -6,6 +6,20 @@ # TODO: For unclear reasons, I could only get it to work with the root user in Packer # 'become' in playbook or role tasks seem to be ignored by Packer Ansible +- name: Prepare OpenBSD for Ansible. + hosts: all + gather_facts: False + tasks: + - name: Ensure, that python is installed. + raw: pkg_add -z python-2.7 + tags: + - openbsd + + - name: Ensure, that python is linked to /usr/bin/python. + raw: ln -sf /usr/local/bin/python2.7 /usr/bin/python + tags: + - openbsd + - name: Initial configuration of a server. hosts: all vars_files: @@ -14,3 +28,6 @@ - role: ansible-initial-server vars: iserver_user: "{{ vm_default_user }}" + iserver_become: su + tags: + - openbsd