From cb4e2091fde9cf3b66d3d1d63cb8bb666f7c0424 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Tue, 31 May 2022 07:36:48 +0200 Subject: [PATCH] init --- LICENSE | 15 +++++++++++++++ README.md | 3 +++ meta/main.yml | 14 ++++++++++++++ molecule/default/converge.yml | 28 ++++++++++++++++++++++++++++ molecule/default/files/members.yml | 6 ++++++ molecule/default/molecule.yml | 19 +++++++++++++++++++ requirements.txt | 4 ++++ tasks/main.yml | 1 + 8 files changed, 90 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 meta/main.yml create mode 100644 molecule/default/converge.yml create mode 100644 molecule/default/files/members.yml create mode 100644 molecule/default/molecule.yml create mode 100644 requirements.txt create mode 100644 tasks/main.yml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..81c795e --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +${REPO_NAME}: ${REPO_DESCRIPTION} +Copyright (C) 2022 Autonomic Co-operative + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff --git a/README.md b/README.md new file mode 100644 index 0000000..55b8d7c --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ${REPO_NAME} + +[![Build Status](https://drone.autonomic.zone/api/badges/autonomic-cooperative/${REPO_NAME}/status.svg?ref=refs/heads/main)](https://drone.autonomic.zone/autonomic-cooperative/${REPO_NAME}) diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..200427c --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,14 @@ +--- +dependencies: [] +galaxy_info: + role_name: ${REPO_NAME_SNAKE} + namespace: autonomic + author: autonomic + description: ${REPO_DESCRIPTION} + company: Autonomic + license: GPLv3 + min_ansible_version: 2.9 + platforms: + - name: Debian + versions: + - buster diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000..baeaaba --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,28 @@ +--- +- name: Converge + hosts: all + vars: + members: files/members.yml + pre_tasks: + - name: Wait for Hetzner VPS networking to come up + pause: + seconds: 10 + echo: false + + - name: Include resource variables + include_vars: "{{ members }}" + + # Note(d1): We create the accounts before the role since we do not make + # molecule test this part of the role under test because we do not setup + # the password store. So, instead, we ensure the other parts are working. + - name: Prepare user accounts for the new role + user: + name: "{{ item.username }}" + shell: /bin/bash + password: "$apr1$GILkREir$r2zDF8rr9Bl8We9UVXnZl1" + groups: "{{ user_groups }}" + append: true + update_password: always + with_items: "{{ members }}" + roles: + - role: autonomic.add-users diff --git a/molecule/default/files/members.yml b/molecule/default/files/members.yml new file mode 100644 index 0000000..9f1aa65 --- /dev/null +++ b/molecule/default/files/members.yml @@ -0,0 +1,6 @@ +--- +members: + - username: foobar + email: barfoo + ssh_key: "ssh-rsa foo bar@nowhere.com" + uid: 1100 diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..19ee81a --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,19 @@ +--- +dependency: + name: galaxy + +driver: + name: hetznercloud + +platforms: + - name: "autonomic.add-users-${INSTANCE_UUID}" + server_type: cx11 + image: debian-10 + +provisioner: + name: ansible + +lint: | + set -e + yamllint -c .yamllint.yml . + ansible-lint --exclude .drone.yml -c .ansible-lint.yml . diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7d6c96a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +ansible-lint==6.0.0 +ansible==5.4.0 +molecule-hetznercloud==1.3.0 +molecule==3.6.1 diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1 @@ +---