{"action":"created","issue":{"url":"https://api.github.com/repos/stationgroup/ansible-experiments/issues/11","repository_url":"https://api.github.com/repos/stationgroup/ansible-experiments","labels_url":"https://api.github.com/repos/stationgroup/ansible-experiments/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/stationgroup/ansible-experiments/issues/11/comments","events_url":"https://api.github.com/repos/stationgroup/ansible-experiments/issues/11/events","html_url":"https://github.com/stationgroup/ansible-experiments/issues/11","id":356604465,"node_id":"MDU6SXNzdWUzNTY2MDQ0NjU=","number":11,"title":"🐞 Bug - ssh_config not working","user":{"login":"reelsense","id":5644977,"node_id":"MDQ6VXNlcjU2NDQ5Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/5644977?v=4","gravatar_id":"","url":"https://api.github.com/users/reelsense","html_url":"https://github.com/reelsense","followers_url":"https://api.github.com/users/reelsense/followers","following_url":"https://api.github.com/users/reelsense/following{/other_user}","gists_url":"https://api.github.com/users/reelsense/gists{/gist_id}","starred_url":"https://api.github.com/users/reelsense/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reelsense/subscriptions","organizations_url":"https://api.github.com/users/reelsense/orgs","repos_url":"https://api.github.com/users/reelsense/repos","events_url":"https://api.github.com/users/reelsense/events{/privacy}","received_events_url":"https://api.github.com/users/reelsense/received_events","type":"User","site_admin":false},"labels":[{"id":883099676,"node_id":"MDU6TGFiZWw4ODMwOTk2NzY=","url":"https://api.github.com/repos/stationgroup/ansible-experiments/labels/bug","name":"bug","color":"d73a4a","default":true},{"id":883099679,"node_id":"MDU6TGFiZWw4ODMwOTk2Nzk=","url":"https://api.github.com/repos/stationgroup/ansible-experiments/labels/help%20wanted","name":"help wanted","color":"008672","default":true}],"state":"open","locked":false,"assignee":{"login":"srgvg","id":382239,"node_id":"MDQ6VXNlcjM4MjIzOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/382239?v=4","gravatar_id":"","url":"https://api.github.com/users/srgvg","html_url":"https://github.com/srgvg","followers_url":"https://api.github.com/users/srgvg/followers","following_url":"https://api.github.com/users/srgvg/following{/other_user}","gists_url":"https://api.github.com/users/srgvg/gists{/gist_id}","starred_url":"https://api.github.com/users/srgvg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srgvg/subscriptions","organizations_url":"https://api.github.com/users/srgvg/orgs","repos_url":"https://api.github.com/users/srgvg/repos","events_url":"https://api.github.com/users/srgvg/events{/privacy}","received_events_url":"https://api.github.com/users/srgvg/received_events","type":"User","site_admin":false},"assignees":[{"login":"srgvg","id":382239,"node_id":"MDQ6VXNlcjM4MjIzOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/382239?v=4","gravatar_id":"","url":"https://api.github.com/users/srgvg","html_url":"https://github.com/srgvg","followers_url":"https://api.github.com/users/srgvg/followers","following_url":"https://api.github.com/users/srgvg/following{/other_user}","gists_url":"https://api.github.com/users/srgvg/gists{/gist_id}","starred_url":"https://api.github.com/users/srgvg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srgvg/subscriptions","organizations_url":"https://api.github.com/users/srgvg/orgs","repos_url":"https://api.github.com/users/srgvg/repos","events_url":"https://api.github.com/users/srgvg/events{/privacy}","received_events_url":"https://api.github.com/users/srgvg/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2018-09-03T21:54:50Z","updated_at":"2018-09-19T21:19:38Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"This example entry below, and any other entry I add in the `ssh_config:` line doesn't seem to insert these config option into my servers. \r\n\r\nhttps://github.com/stationgroup/ansible-experiments/blob/f425969a79a23f5526e88085b640b2e1f0b35c3f/add-users-groups-authorized_keys-dot-files/group_vars/all#L37-L38\r\n\r\nAlso the whole  `~/.ssh/config` file is empty.\r\n\r\n`less ~/.ssh/config`\r\n```\r\n# BEGIN ANSIBLE MANAGED BLOCK\r\n\r\n# END ANSIBLE MANAGED BLOCK\r\n```\r\n\r\n---\r\nOn a related note this [`ssh-config/defaults/main.yml`](https://github.com/stationgroup/ansible-experiments/blob/master/add-users-groups-authorized_keys-dot-files/roles/ssh-config/defaults/main.yml) file is empty. Is that on purpose?\r\n\r\n---\r\nCC: @vincentvdk \r\nx-post: https://github.com/stationgroup/ansible-experiments/issues/9"},"comment":{"url":"https://api.github.com/repos/stationgroup/ansible-experiments/issues/comments/422962420","html_url":"https://github.com/stationgroup/ansible-experiments/issues/11#issuecomment-422962420","issue_url":"https://api.github.com/repos/stationgroup/ansible-experiments/issues/11","id":422962420,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjk2MjQyMA==","user":{"login":"reelsense","id":5644977,"node_id":"MDQ6VXNlcjU2NDQ5Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/5644977?v=4","gravatar_id":"","url":"https://api.github.com/users/reelsense","html_url":"https://github.com/reelsense","followers_url":"https://api.github.com/users/reelsense/followers","following_url":"https://api.github.com/users/reelsense/following{/other_user}","gists_url":"https://api.github.com/users/reelsense/gists{/gist_id}","starred_url":"https://api.github.com/users/reelsense/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reelsense/subscriptions","organizations_url":"https://api.github.com/users/reelsense/orgs","repos_url":"https://api.github.com/users/reelsense/repos","events_url":"https://api.github.com/users/reelsense/events{/privacy}","received_events_url":"https://api.github.com/users/reelsense/received_events","type":"User","site_admin":false},"created_at":"2018-09-19T21:19:38Z","updated_at":"2018-09-19T21:19:38Z","author_association":"CONTRIBUTOR","body":"I merged your changes in https://github.com/stationgroup/ansible-experiments/commit/f708bc9c802af5482fa3ead5115c3747624a97f4. It stops the problem I had with errors, but it doesn't  seem to add my entries in `group_vars/all` to `~/.ssh/config`\r\n\r\n<details>\r\n  <summary>(Click to expand group_vars/all)</summary>\r\n\r\n```yaml\r\n---\r\nuser_groups:\r\n  - name: test\r\n    gid: 799\r\n    state: absent\r\n    \r\n\r\nusers:\r\n  - name: ec2-user\r\n    state: present\r\n    enable_sudo: true\r\n    keys:\r\n      - file: ec2-user\r\n        state: present\r\n  - name: ubuntu\r\n    state: present\r\n    enable_sudo: true\r\n    keys: \r\n      - file: ubuntu\r\n        state: present\r\n    bash_lines:\r\n      - line: 'export GPG_AGENT_INFO=\"${HOME}/.gnupg/S.gpg-agent:0:1\"'\r\n        state: absent\r\n    bash_lines:\r\n      - line: 'export SSH_AUTH_SOCK=\"${HOME}/.gnupg/S.gpg-agent\"'\r\n        state: present\r\n    bash_blocks:\r\n      - content: |\r\n          # SSH with GPG key on Yubikey\r\n          export GPG_TTY=\"$(tty)\"\r\n          export SSH_AUTH_SOCK=\"${HOME}/.gnupg/S.gpg-agent\"\r\n        state: absent\r\n      - content: |\r\n          ###\r\n          ## Filecount in a directory.\r\n          alias filecount='find . -maxdepth 1 -type f -print | wc -l'\r\n          ## Reload shell\r\n          alias reload-bash_profile=\"source ~/.bashrc\"\r\n          ###\r\n          \r\n\r\n          ###\r\n          # Change UP and DOWN arrows to cycle through previous entrys of the current command. Like FreeBSD.\r\n          # From http://www.ukuug.org/events/linux2003/papers/bash_tips/\r\n          # Incremental searching with Up and Down is configured in .inputrc\r\n          bind '\"\\e[A\": history-search-backward'\r\n          bind '\"\\e[B\": history-search-forward'\r\n          \r\n          #\"\\e[5~\": history-search-backward\r\n          #\"\\e[6~\": history-search-forward\r\n          #This allows you to continue using arrows for absolute chronological history then use PageUp and PageDn for history search.\r\n          #You could also change it to.\r\n          #\"\\e[5~\": history-substring-search-backward\r\n          #\"\\e[6~\": history-substring-search-forward\r\n          ###\r\n        state: present\r\n    ssh_config:\r\n      - line: \"ServerAliveInterval: 10\"\r\n      - line: \"StreamLocalBindUnlink: yes\"\r\n```\r\n\r\nI'm using:\r\n```\r\n    ssh_config:\r\n      - line: \"ServerAliveInterval: 10\"\r\n      - line: \"StreamLocalBindUnlink: yes\"\r\n```\r\nas per PR #12 \r\n\r\n</details>\r\n\r\n\r\n---\r\n\r\nI've made some minor changes to fix issues a chicken and egg issue with _FreeBSD_. But nothing that should have broke ssh_config. \r\n\r\n\r\n\r\n\r\n<details>\r\n  <summary>(Click to expand roles/users/tasks/users.yml)</summary>\r\n\r\n![whoppingdearestamazonparrot-max-14mb](https://user-images.githubusercontent.com/5644977/45781877-26240f80-bc16-11e8-8468-f9fd6ad92ab6.gif)\r\n\r\n\r\n```yaml\r\n---\r\n- name: Ensure sudo is installed (Debian)\r\n  become_method: sudo\r\n  apt:\r\n    name: sudo\r\n    update_cache: yes\r\n    cache_valid_time: \"{{ apt_cache_valid | default('86400') }}\"\r\n  when: ansible_os_family == \"Debian\"\r\n\r\n- name: Ensure sudo is installed (FreeBSD)\r\n  become_method: su\r\n  pkgng:\r\n    name: sudo\r\n    state: present\r\n  when: ansible_os_family == \"FreeBSD\"\r\n\r\n- name: Enable sudo for user (FreeBSD)\r\n  become_method: su\r\n  lineinfile:\r\n    path: \"{{ sudoers_path }}/{{ item.name }}\"\r\n    line: \"{{ item.name }} ALL=(ALL) NOPASSWD:ALL\"\r\n    state: present\r\n    create: true\r\n  when:\r\n    - ansible_os_family == \"FreeBSD\" \r\n    - item.enable_sudo is defined and item.enable_sudo == true\r\n  with_items: \"{{ users }}\"\r\n\r\n- name: Enable sudo for user (Ubuntu)\r\n  become_method: sudo\r\n  lineinfile:\r\n    path: \"{{ sudoers_path }}/{{ item.name }}\"\r\n    line: \"{{ item.name }} ALL=(ALL) NOPASSWD:ALL\"\r\n    state: present\r\n    create: true\r\n  when:\r\n    - ansible_os_family == \"Debian\"\r\n    - item.enable_sudo is defined and item.enable_sudo == true\r\n  with_items: \"{{ users }}\"\r\n\r\n- name: Add/Remove group\r\n  become_method: sudo\r\n  group:\r\n    name: \"{{ item.name }}\"\r\n    gid: \"{{ item.gid | default(omit) }}\"\r\n    state: \"{{ item.state | default('present') }}\"\r\n  with_items: \"{{ user_groups }}\"\r\n\r\n\r\n- name: Add/Remove user\r\n  become_method: sudo\r\n  user:\r\n    name: \"{{ item.name }}\"\r\n    state: \"{{ item.state | default('present') }}\"\r\n    password: \"{{ item.password | default(omit) }}\"\r\n    groups: \"{{ item.groups | default(omit) }}\"\r\n    uid: \"{{ item.uid | default(omit) }}\"\r\n    shell: \"{{ item.shell | default(default_shell) }}\"\r\n    remove: yes\r\n  no_log: False\r\n  with_items: \"{{ users }}\"\r\n\r\n\r\n- name: Configure bashrc lines\r\n  become_method: sudo\r\n  lineinfile:\r\n    path: \"/home/{{ item.0.name }}/.bashrc\"\r\n    line: \"{{ item.1.line }}\"\r\n    state: \"{{ item.1.state | default('present') }}\"\r\n    backup: yes\r\n  with_subelements:\r\n    - \"{{ users }}\"\r\n    - bash_lines\r\n    - skip_missing: true\r\n  when: ansible_os_family == 'Debian' and item.0.state == \"present\"\r\n\r\n- name: Configure bashrc blocks\r\n  become_method: sudo\r\n  blockinfile:\r\n    path: \"/home/{{ item.0.name }}/.bashrc\"\r\n    content: \"{{ item.1.content }}\"\r\n    marker: \"# {mark} ANSIBLE managed content. Block item #{{ listitem }}\"\r\n    state: \"{{ item.1.state | default('present') }}\"\r\n    backup: yes\r\n  with_subelements:\r\n    - \"{{ users }}\"\r\n    - bash_blocks\r\n    - skip_missing: true\r\n  when: ansible_os_family == 'Debian' and item.0.state == \"present\"\r\n  loop_control:\r\n    index_var: listitem\r\n\r\n- name: Configure cshrc lines\r\n  become_method: su\r\n  lineinfile:\r\n    path: \"/home/{{ item.0.name }}/.cshrc\"\r\n    line: \"{{ item.1.line }}\"\r\n    state: \"{{ item.1.state | default('present')}}\"\r\n    backup: yes\r\n  with_subelements:\r\n    - \"{{ users }}\"\r\n    - csh_lines\r\n    - skip_missing: true\r\n  when: ansible_os_family == 'FreeBSD' and item.0.state == \"present\"\r\n\r\n- name: Configure cshrc blocks\r\n  become_method: su\r\n  blockinfile:\r\n    path: \"/home/{{ item.0.name }}/.cshrc\"\r\n    content: \"{{ item.1.content }}\"\r\n    marker: \"# {mark} ANSIBLE managed content. Block item #{{ listitem }}\"\r\n    state: \"{{ item.1.state | default('present')}}\"\r\n    backup: yes\r\n  with_subelements:\r\n    - \"{{ users }}\"\r\n    - csh_blocks\r\n    - skip_missing: true\r\n  when: ansible_os_family == 'FreeBSD' and item.0.state == \"present\"\r\n  loop_control:\r\n    index_var: listitem\r\n\r\n- name: Disable sudo for user\r\n  become: true\r\n  file:\r\n    path: \"{{ sudoers_path }}/{{ item.name }}\"\r\n    state: absent\r\n  when: item.enable_sudo is defined and item.enable_sudo == false\r\n  with_items: \"{{ users }}\"\r\n\r\n- name: Include sudoers.d\r\n  become: true\r\n  lineinfile:\r\n    dest: \"{{ sudo_config_path }}\"\r\n    state: present\r\n    regexp: '^\\#includedir {{ sudoers_path }}'\r\n    line: '#includedir {{ sudoers_path }}'\r\n    validate: 'visudo -cf %s'\r\n\r\n\r\n```\r\n\r\n</details>"}}
{"actor":{"display_login":"reelsense"}}