1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_weechat.git synced 2024-08-16 13:09:48 +02:00
ansible_role_weechat/tasks/configure_custom_config.yml

68 lines
2.2 KiB
YAML
Raw Normal View History

---
- name: create ssh key pair (if needed)
become: true
2021-05-27 16:03:41 +02:00
community.crypto.openssh_keypair:
2021-05-27 16:18:04 +02:00
path: "{{ weechat__home_directory }}/.ssh/id_ed25519"
type: ed25519
2021-05-27 16:18:04 +02:00
owner: "{{ weechat__user }}"
register: ssh_key_pair
2021-05-27 16:18:04 +02:00
when: weechat__custom_gen_ssh_key_pair | bool
- name: print ssh public key to user
ansible.builtin.pause:
prompt: |
We generated a new ssh key pair for you.
Please use the following public key as deployment key
to your private git repository with your own weechat config.
Private git repositorys are not public available and
you need some sort of authorisation method to verify
that you are allowed to clone your private repo.
Your ssh public key come here...
{{ ssh_key_pair.public_key }}
Please be aware, that this role do not commit or
push any local changes and you have to do this
manually by yourself.
when:
2021-06-03 15:03:44 +02:00
- weechat__custom_gen_ssh_key_pair | bool
- ssh_key_pair.changed
2020-03-12 22:44:15 +01:00
2020-03-14 16:24:59 +01:00
- name: clone or update private git repository
2020-03-12 22:44:15 +01:00
become: true
2020-03-14 16:24:59 +01:00
block:
- name: try to download/update git repo
ansible.builtin.git:
2021-05-27 16:18:04 +02:00
repo: "{{ weechat__custom_private_repo }}"
dest: "{{ weechat__home_directory }}/.weechat"
version: "{{ weechat__custom_config.version | default ('main') }}"
accept_hostkey: true
update: true
2021-05-27 16:18:04 +02:00
ssh_opts: "-i {{ weechat__home_directory }}/.ssh/id_ed25519"
2020-03-14 16:24:59 +01:00
rescue:
- name: wait until you fixed remote git issues
pause:
prompt: "Please fix the issue with your git repository and try again"
- name: try to download/update git repo again
ansible.builtin.git:
2021-05-27 16:18:04 +02:00
repo: "{{ weechat__custom_private_repo }}"
dest: "{{ weechat__home_directory }}/.weechat"
version: "{{ weechat__custom_config.version | default ('main') }}"
accept_hostkey: true
update: true
2021-05-27 16:18:04 +02:00
ssh_opts: "-i {{ weechat__home_directory }}/.ssh/id_ed25519"
when: not weechat__custom_private_repo | bool
2021-05-27 16:03:41 +02:00
2021-08-12 00:31:07 +02:00
- name: "change git repo owner to {{ weechat__user }}"
2021-05-27 16:03:41 +02:00
become: true
ansible.builtin.file:
2021-05-27 16:18:04 +02:00
path: "{{ weechat__home_directory }}/.weechat"
2021-05-27 16:03:41 +02:00
recurse: true
2021-05-27 16:18:04 +02:00
owner: "{{ weechat__user }}"
when: not weechat__custom_private_repo | bool