diff --git a/defaults/main.yml b/defaults/main.yml index a39bde1..246772a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -23,6 +23,8 @@ weechat: private_repo: false # generate ssh key pair (if not available) gen_ssh_key_pair: true + # the tag, commit or branch we should check out + version: 'main' # version check for this role? (true is recomended) submodules_versioncheck: false diff --git a/tasks/configure_custom_config.yml b/tasks/configure_custom_config.yml index 9cec6ab..d5cfce3 100644 --- a/tasks/configure_custom_config.yml +++ b/tasks/configure_custom_config.yml @@ -1,8 +1,7 @@ --- - name: create ssh key pair (if needed) - become_user: "{{ weechat.user }}" become: true - community.cryptop.openssh_keypair: + community.crypto.openssh_keypair: path: "{{ weechat.home_directory }}/.ssh/id_ed25519" type: ed25519 owner: "{{ weechat.user }}" @@ -34,16 +33,16 @@ - ssh_key_pair.changed - name: clone or update private git repository - become_user: "{{ weechat.user }}" become: true block: - name: try to download/update git repo ansible.builtin.git: repo: "{{ weechat.custom_config.private_repo }}" dest: "{{ weechat.home_directory }}/.weechat" - version: master + version: "{{ weechat.custom_config.version | default ('main') }}" accept_hostkey: true update: true + ssh_opts: "-i {{ weechat.home_directory }}/.ssh/id_ed25519" rescue: - name: wait until you fixed remote git issues pause: @@ -56,4 +55,13 @@ version: master accept_hostkey: true update: true + ssh_opts: "-i {{ weechat.home_directory }}/.ssh/id_ed25519" + when: not weechat.custom_config.private_repo | bool + +- name: "change git repo ownwe to {{ weechat.user }}" + become: true + ansible.builtin.file: + path: "{{ weechat.home_directory }}/.weechat" + recurse: true + owner: "{{ weechat.user }}" when: not weechat.custom_config.private_repo | bool diff --git a/tasks/configure_plugins.yml b/tasks/configure_plugins.yml index b1d030d..777a808 100644 --- a/tasks/configure_plugins.yml +++ b/tasks/configure_plugins.yml @@ -1,7 +1,6 @@ --- - name: create weechat directory become: true - become_user: "{{ weechat.user }}" file: path: "{{ weechat.home_directory }}/.weechat" state: directory @@ -10,7 +9,6 @@ - name: create weechat plugins directory become: true - become_user: "{{ weechat.user }}" file: path: "{{ weechat.home_directory }}/.weechat/{{ item.value }}/autoload" state: directory diff --git a/vars/main.yml b/vars/main.yml index 0d4838d..8a1485e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -9,7 +9,7 @@ weechat_plugin_languages: lua: lua # version management -playbook_version_number: 4199 # should be over ninethousand +playbook_version_number: 4200 # should be over ninethousand playbook_version_path: 'role-weechat_roles-ansible_github.com.version' # default values