diff options
| author | Aaron LI <aly@aaronly.me> | 2018-05-15 20:16:50 +0800 | 
|---|---|---|
| committer | Aaron LI <aly@aaronly.me> | 2018-05-15 20:16:50 +0800 | 
| commit | 72e1527399880eb9800a52653fd635c968d4be35 (patch) | |
| tree | 93d836635f51e23fc3923319839f0a265a0863a7 | |
| parent | bbfac4101eaaa27a053560cb9cadfe5e807c12da (diff) | |
| download | ansible-dfly-vps-72e1527399880eb9800a52653fd635c968d4be35.tar.bz2 | |
git: remove some obsolete settings
| -rw-r--r-- | group_vars/all/vars.yml | 2 | ||||
| -rw-r--r-- | roles/git/tasks/main.yml | 82 | 
2 files changed, 34 insertions, 50 deletions
| diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index f1ce97f..66cd4a5 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -190,8 +190,6 @@ git:      name: git  # user & group name      id: 5001  # uid & gid      home: /home/git -  # Name of the directory that contains links to the public repos -  public_dir: repos.public    # Sync public repos to GitHub    # NOTE: an unencrypted ssh keypair is required and been added to GitHub    github: diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index caf04f8..ebd2ef3 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -34,54 +34,6 @@      -c "Git Repositories Owner"    when: pw_cmd.rc != 0 -- name: generate vars.conf file -  template: -    src: vars.conf.j2 -    dest: "{{ git.user.home }}/vars.conf" - -- name: copy git-shell commands -  copy: -    src: git-shell-commands/  # trailing '/' -> directory contents -    dest: "{{ git.user.home }}/git-shell-commands/" -    mode: 0755 - -- name: (local) github sync - check ssh key existence -  become: false -  stat: -    path: "{{ git.github.keyfile }}" -  delegate_to: localhost -  register: stat_result - -- name: (local) github sync - generate new ssh key pair -  become: false -  command: > -    ssh-keygen -t ed25519 -C "git:github-sync" -N "" -    -f "{{ git.github.keyfile }}" -  delegate_to: localhost -  when: not stat_result.stat.exists - -- name: github sync - create .ssh directory on the server -  file: -    path: "{{ git.user.home }}/.ssh" -    state: directory -    owner: "{{ git.user.name }}" -    group: "{{ git.user.name }}" -    mode: 0700 - -- name: github sync - copy public key to the server -  copy: -    src: "{{ git.github.keyfile }}" -    dest: "{{ git.user.home }}/.ssh/id_{{ git.github.keytype }}" -    owner: "{{ git.user.name }}" -    mode: 0400 - -- name: create directory for linking public repos -  file: -    path: "{{ git.user.home }}/{{ git.public_dir }}" -    state: directory -    owner: "{{ git.user.name }}" -    group: "{{ git.user.name }}" -  #  # gitolite  # @@ -138,6 +90,40 @@    tags: gitolite  # +# Github sync +# + +- name: (local) github sync - check ssh key existence +  become: false +  stat: +    path: "{{ git.github.keyfile }}" +  delegate_to: localhost +  register: stat_result + +- name: (local) github sync - generate new ssh key pair +  become: false +  command: > +    ssh-keygen -t ed25519 -C "git:github-sync" -N "" +    -f "{{ git.github.keyfile }}" +  delegate_to: localhost +  when: not stat_result.stat.exists + +- name: github sync - create .ssh directory on the server +  file: +    path: "{{ git.user.home }}/.ssh" +    state: directory +    owner: "{{ git.user.name }}" +    group: "{{ git.user.name }}" +    mode: 0700 + +- name: github sync - copy public key to the server +  copy: +    src: "{{ git.github.keyfile }}" +    dest: "{{ git.user.home }}/.ssh/id_{{ git.github.keytype }}" +    owner: "{{ git.user.name }}" +    mode: 0400 + +#  # cgit  # | 
