Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible: introduce create-github-bot playbook #1067

Merged
merged 1 commit into from
Jun 19, 2018

Conversation

maclover7
Copy link
Contributor

@maclover7 maclover7 commented Jan 3, 2018

This is a migrated version of the playbook that lives in setup/github-bot.

I have tested this on the production server, and works good.

I will be removing the setup/github-bot directory in a later PR, to avoid a smaller diff.

cc infra admins: @gibfahn @jbergstroem @joaocgreis @mhdawson @rvagg
cc @phillipj

@maclover7
Copy link
Contributor Author

ping @nodejs/build

gibfahn

This comment was marked as off-topic.

@mhdawson
Copy link
Member

Agreed I'm fine with adding these, but we should have a review from team supporting the bot to make sure its complete.

mhdawson

This comment was marked as off-topic.

joaocgreis

This comment was marked as off-topic.

@gibfahn
Copy link
Member

gibfahn commented Jan 16, 2018

I would have preferred the setup/github-bot folder to be removed here as part of the same commit, to make it obvious in the diff that this was a migration

💯 to that

@maclover7
Copy link
Contributor Author

@phillipj (or anyone else with infra permissions level -- I don't have access) would you be able to run this playbook on the production server and make sure everything looks okay? I have tested locally on a Vagrant machine, but I just want to be sure nothing will break. After that, I will land this PR and remove setup/github-bot.

@phillipj
Copy link
Member

I'm so sorry for not having given this a test run yet, it got buried in my mail backlog. I'll do my best to have a look at this today.

@phillipj
Copy link
Member

This is the first time I'm trying to run a playbook in the new ansible setup, so this might be me doing something wrong... I'm not able to run the playbook because the host is not found in the inventory:

$ cd ansible
$ ansible-playbook --check -i inventory.yml playbooks/create-github-bot.yml
 [WARNING]: Could not match supplied host pattern, ignoring: all

 [WARNING]: provided hosts list is empty, only localhost is available

[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated. Use 'import_tasks' for static inclusions or 'include_tasks' for dynamic
inclusions. This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: include is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about
this rationale.. This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
 [WARNING]: Could not match supplied host pattern, ignoring: infra-rackspace-debian8-x64-1


PLAY [infra-rackspace-debian8-x64-1] *************************************************************************************************************************
skipping: no hosts matched

PLAY RECAP ***************************************************************************************************************************************************

I assume that's because ./ansible/inventory.yml doesn't contain an entry for infra-rackspace-debian8-x64-1 like ./setup/ansible-inventory#L172 has?

@maclover7
Copy link
Contributor Author

@phillipj It looks like the machine is listed in ansible/inventory.yml , but I think you may have to specify it manually -- can you try adding --limit infra-rackspace-debian8-x64-1 to ansible-playbook?

@phillipj
Copy link
Member

Sadly I get more or less the same error when including --limit:

$ ansible-playbook --check -i inventory.yml --limit infra-rackspace-debian8-x64-1 playbooks/create-github-bot.yml
 [WARNING]: Could not match supplied host pattern, ignoring: all

 [WARNING]: provided hosts list is empty, only localhost is available

 [WARNING]: Could not match supplied host pattern, ignoring: infra-rackspace-debian8-x64-1

[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated. Use 'import_tasks' for static inclusions or 'include_tasks' for dynamic
inclusions. This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: include is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about
this rationale.. This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

PLAY [infra-rackspace-debian8-x64-1] *************************************************************************************************************************
skipping: no hosts matched

PLAY RECAP ***************************************************************************************************************************************************

I'm currently running ansible v2.4.2.0 if that's important by any chance.

@maclover7
Copy link
Contributor Author

Hmmm, interesting -- I'm running the same version of Ansible. Are you able to just run the playbook directly (ansible-playbook --limit infra-rackspace-debian8-x64-1 playbooks/create-github-bot.yml) and verify that way? That was what I was using to test locally

@phillipj
Copy link
Member

That for sure worked better, though still fails:

$ ansible-playbook --check --limit infra-rackspace-debian8-x64-1 playbooks/create-github-bot.yml
[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated. Use 'import_tasks' for static inclusions or 'include_tasks' for dynamic
inclusions. This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: include is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about
this rationale.. This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

PLAY [infra-rackspace-debian8-x64-1] *************************************************************************************************************************

TASK [check if secrets are properly set] *********************************************************************************************************************
 [WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: not {{ secret }}

ok: [infra-rackspace-debian8-x64-1] => (item=envs.port)
ok: [infra-rackspace-debian8-x64-1] => (item=envs.travis_token)
ok: [infra-rackspace-debian8-x64-1] => (item=envs.github_token)
ok: [infra-rackspace-debian8-x64-1] => (item=envs.github_webhook_secret)
ok: [infra-rackspace-debian8-x64-1] => (item=envs.login_credentials)
ok: [infra-rackspace-debian8-x64-1] => (item=envs.jenkins_api_credentials)
ok: [infra-rackspace-debian8-x64-1] => (item=envs.jenkins_job_url_citgm)
ok: [infra-rackspace-debian8-x64-1] => (item=envs.jenkins_build_token_citgm)
ok: [infra-rackspace-debian8-x64-1] => (item=conf.github_deploy_webhook_secret)

TASK [bootstrap : run os-specific bootstrap] *****************************************************************************************************************
included: /github/build/ansible/roles/bootstrap/tasks/partials/debian8.yml for infra-rackspace-debian8-x64-1

TASK [bootstrap : check for apt-transport-https] *************************************************************************************************************
skipping: [infra-rackspace-debian8-x64-1]

TASK [bootstrap : install apt-transport-https] ***************************************************************************************************************
fatal: [infra-rackspace-debian8-x64-1]: FAILED! => {"msg": "The conditional check 'has_apt_transport.rc == 1' failed. The error was: error while evaluating conditional (has_apt_transport.rc == 1): 'dict object' has no attribute 'rc'\n\nThe error appears to have been in '/Users/flipp/Dev/github/build/ansible/roles/bootstrap/tasks/partials/debian8.yml': line 12, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: install apt-transport-https\n  ^ here\n"}

PLAY RECAP ***************************************************************************************************************************************************
infra-rackspace-debian8-x64-1 : ok=2    changed=0    unreachable=0    failed=1

@maclover7
Copy link
Contributor Author

@phillipj Hmm, interesting. The odd thing about that failure is that the bootstrap playbook works fine on all of the build WG's Debian machines (I just tested the playbooks a few days ago.) Are you able to do a apt-get dist-upgrade and see if that does anything? Weird this is the one machine it's not working on.

@phillipj
Copy link
Member

@maclover7 a dist-upgrade had no impact I'm afraid, still getting the same error in the install apt-transport-https task.

I'm for sure open to me possibly doing something wrong here, since I haven't tested this new ansible set before.

Any hint of other playbook(s) you'd recommend me doing a test run on, to double check I'm able to run something that we know works for others?

@gibfahn
Copy link
Member

gibfahn commented Feb 14, 2018

@phillipj what version of ansible-playbook do you have (and what machine are you running on)?

@phillipj
Copy link
Member

macOS v10.12.6 (16G29) +

$ ansible-playbook --version
ansible-playbook 2.4.2.0
  config file = None
  configured module search path = [u'/Users/phillipj/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 2.7.10 (default, Feb  7 2017, 00:08:15) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]

@gibfahn
Copy link
Member

gibfahn commented Feb 14, 2018

Looks like I don't have access, should the infra team have access to github-bot secrets?

Looks like Rod, Joao and Johan have access.

@phillipj
Copy link
Member

I don't see why infra team shouldn't have. IIRC that's the team that has SSH-access to the bot server, I've just been granted access to that host explicitly.

@maclover7
Copy link
Contributor Author

@phillipj Just updated this PR, and ran it on the production server -- all looks to be okay. Would appreciate a review if possible

gdams

This comment was marked as off-topic.

maclover7 added a commit to maclover7/build that referenced this pull request Jun 18, 2018
This has been migrated via nodejs#1067.
phillipj

This comment was marked as off-topic.

phillipj

This comment was marked as off-topic.

@maclover7
Copy link
Contributor Author

Went over payload with @phillipj over IRC, and it seems legit. Adding those IPs to the whitelist, and then @phillipj said it would be okay to land

This is a migrated version of the playbook that lives in
`setup/github-bot`.

I have tested this on the production server, and works good.

I will be removing the `setup/github-bot` directory in a later PR, to
avoid a gigantic diff.
@maclover7 maclover7 merged commit 1b3f78e into nodejs:master Jun 19, 2018
@maclover7
Copy link
Contributor Author

Landed in 1b3f78e

@maclover7 maclover7 deleted the jm-ansible-bot branch June 19, 2018 13:08
maclover7 added a commit that referenced this pull request Jun 19, 2018
This has been migrated via #1067.

PR-URL: #1362
Reviewed-By: Phillip Johnsen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants