Skip to content

Commit

Permalink
Initial Runner commit
Browse files Browse the repository at this point in the history
Need to append runner's(user) password
  • Loading branch information
cradle8810 committed May 11, 2024
1 parent 987b20a commit b0b8cd7
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
4 changes: 4 additions & 0 deletions inventories/host_vars/runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
apt:
- python3-pip
- zsh
73 changes: 73 additions & 0 deletions runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
- name: Play for runner.hayaworld.local
hosts: runner
remote_user: hayato
gather_facts: true
become: true

vars_files:
- inventories/host_vars/runner.yml
- inventories/host_vars/networks.yml

tasks:
- name: Set Hostname
ansible.builtin.hostname:
name: "{{ network.runner.hostname }}"
tags:
- network

- name: Put authorized Key
ansible.builtin.import_tasks:
file: tasks/authorized_keys.yml

- name: Put motd file
ansible.builtin.import_tasks:
file: tasks/motd.yml
vars:
shortname: "{{ network.runner.shortname }}"

- name: Disable SELinux
ansible.builtin.import_tasks:
file: tasks/stop-selinux.yml

- name: Set Timezones
ansible.builtin.import_tasks:
file: tasks/timezone.yml

- name: Stop Apt-daily
ansible.builtin.import_tasks:
file: tasks/stop-apt-daily.yml

- name: Stop cloud-init
ansible.builtin.import_tasks:
file: tasks/stop-cloud-init.yml

- name: Apt install
ansible.builtin.import_tasks:
file: tasks/console/apt.yml

- name: Add user for runner execution
ansible.builtin.user:
name: runner
shell: /bin/bash
groups: sudo
append: true
expires: -1

- name: Put authorized Key for runner
ansible.builtin.import_tasks:
file: tasks/authorized_keys.yml

- name: Install Docker(ce)
ansible.builtin.import_role:
name: geerlingguy.docker
vars:
docker_edition: 'ce'
docker_packages_state: present
docker_service_manage: true
docker_service_state: started
docker_service_enabled: true
docker_restart_handler_state: restarted
docker_users:
- hayato
- runner
20 changes: 20 additions & 0 deletions tasks/runner/authorized_keys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: "Make directory ~/.ssh/"
ansible.builtin.file:
path: /home/runner/.ssh/
state: directory
owner: runner
group: runner
mode: '0700'
tags:
- authorized_keys

- name: "Put authorized_keys"
ansible.builtin.copy:
src: templates/home/hayato/.ssh/authorized_keys
dest: /home/runner/.ssh/authorized_keys
owner: runner
group: runner
mode: '0600'
tags:
- authorized_keys
4 changes: 4 additions & 0 deletions templates/runner/etc/motd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_ __ _ _ _ __ _ __ ___ _ __
| '__| | | | '_ \| '_ \ / _ \ '__|
| | | |_| | | | | | | | __/ |
|_| \__,_|_| |_|_| |_|\___|_|

0 comments on commit b0b8cd7

Please sign in to comment.