Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14984e7469
|
||
|
|
874e1d633a
|
||
|
|
a55e12762f
|
||
|
|
2afad33ad2
|
||
|
|
adc35381da
|
No files matched your search
@@ -0,0 +1,22 @@
|
|||||||
|
name: Release Ansible Role
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '**'
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release Ansible Role
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Install Ansible Galaxy
|
||||||
|
run: |
|
||||||
|
apt update --yes
|
||||||
|
apt install --yes ansible
|
||||||
|
- env:
|
||||||
|
ANSIBLE_GALAXY_TOKEN: ${{ secrets.ANSIBLE_GALAXY_TOKEN }}
|
||||||
|
name: Update Ansible Role in Ansible Galaxy
|
||||||
|
run: |
|
||||||
|
ansible-galaxy role import --token=${ANSIBLE_GALAXY_TOKEN} volker-raschek ${GITHUB_REPOSITORY#*/}
|
||||||
Vendored
+2
-2
@@ -3,12 +3,12 @@
|
|||||||
"files.associations": {
|
"files.associations": {
|
||||||
"**/.gitea/**/*.yml": "yaml",
|
"**/.gitea/**/*.yml": "yaml",
|
||||||
"**/.gitea/**/*.yaml": "yaml",
|
"**/.gitea/**/*.yaml": "yaml",
|
||||||
".drone.yml": "yaml",
|
|
||||||
"docker-compose*.yml": "dockercompose",
|
"docker-compose*.yml": "dockercompose",
|
||||||
"*.yml": "ansible",
|
"*.yml": "ansible",
|
||||||
"*.yaml": "ansible",
|
"*.yaml": "ansible",
|
||||||
".yamllint": "yaml",
|
".yamllint": "yaml",
|
||||||
".yamllint.yml": "yaml",
|
".yamllint.yml": "yaml",
|
||||||
".yamllint.yaml": "yaml"
|
".yamllint.yaml": "yaml"
|
||||||
}
|
},
|
||||||
|
"rewrap.wrappingColumn": 120
|
||||||
}
|
}
|
||||||
+7
-1
@@ -8,5 +8,11 @@ root: {}
|
|||||||
# StrictHostKeyChecking: "no"
|
# StrictHostKeyChecking: "no"
|
||||||
# UserKnownHostFile: /dev/null
|
# UserKnownHostFile: /dev/null
|
||||||
# authorized_keys:
|
# authorized_keys:
|
||||||
# - filename: markus@markus-pc.pub
|
# - content: ssh-ed25519 AAAAC3NzaC... alice
|
||||||
# # command: "" # optional
|
# # command: "" # optional
|
||||||
|
# private_keys:
|
||||||
|
# - filename: alice@alice-pc.ed25519.key
|
||||||
|
# content: |
|
||||||
|
# -----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
|
# ...
|
||||||
|
# -----END OPENSSH PRIVATE KEY-----
|
||||||
+10
-7
@@ -80,24 +80,27 @@
|
|||||||
block:
|
block:
|
||||||
- name: "Create private SSH keys"
|
- name: "Create private SSH keys"
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ playbook_dir }}/ssh/private_keys/{{ item }}"
|
content: "{{ item.content }}"
|
||||||
dest: "/root/.ssh/{{ item }}"
|
dest: "/root/.ssh/{{ item.filename }}"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
mode: "0600"
|
mode: "0600"
|
||||||
with_items:
|
loop: "{{ root.ssh.private_keys }}"
|
||||||
- "{{ root.ssh.private_keys }}"
|
loop_control:
|
||||||
|
label: "{{ item.filename }}"
|
||||||
|
|
||||||
- name: "Extract public SSH keys from private keys"
|
- name: "Extract public SSH keys from private keys"
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
cmd: "ssh-keygen -y -f /root/.ssh/{{ item }} > /root/.ssh/{{ item }}.pub"
|
cmd: "ssh-keygen -y -f {{ ('/root/.ssh/' + item.filename) | quote }} > {{ ('/root/.ssh/' + item.filename + '.pub') | quote }}"
|
||||||
|
creates: "/root/.ssh/{{ item.filename }}.pub"
|
||||||
register: _root_ssh_pub_key_extraction
|
register: _root_ssh_pub_key_extraction
|
||||||
changed_when: _root_ssh_pub_key_extraction.rc == 0
|
changed_when: _root_ssh_pub_key_extraction.rc == 0
|
||||||
failed_when: _root_ssh_pub_key_extraction.rc > 0
|
failed_when: _root_ssh_pub_key_extraction.rc > 0
|
||||||
with_items:
|
loop: "{{ root.ssh.private_keys }}"
|
||||||
- "{{ root.ssh.private_keys }}"
|
loop_control:
|
||||||
|
label: "{{ item.filename }}"
|
||||||
|
|
||||||
- name: "Create custom SSH client config"
|
- name: "Create custom SSH client config"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
#
|
#
|
||||||
{% for authorized_key in root.ssh.authorized_keys %}
|
{% for authorized_key in root.ssh.authorized_keys %}
|
||||||
{% if authorized_key.command is defined and authorized_key.command | length > 0 %}
|
{% if authorized_key.command is defined and authorized_key.command | length > 0 %}
|
||||||
command="{{ authorized_key.command }}" {{ lookup('file', 'ssh/authorized_keys/' + authorized_key.filename ) }}
|
command="{{ authorized_key.command }}" {{ authorized_key.content | trim }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ lookup('file', 'ssh/authorized_keys/' + authorized_key.filename ) }}
|
{{ authorized_key.content | trim }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
Reference in new issue
Block a user