Skip to content

Instantly share code, notes, and snippets.

@mazz
Created February 25, 2017 21:31
Show Gist options
  • Select an option

  • Save mazz/7cf208041e5c5b2356936480e1d9df48 to your computer and use it in GitHub Desktop.

Select an option

Save mazz/7cf208041e5c5b2356936480e1d9df48 to your computer and use it in GitHub Desktop.
The Ansible server connection did not have SSH agent forwarding enabled or you have become_user\\:root in your playbook which you should not have
~/src/ansible/websauna.ansible (master ✔) ᐅ ansible-playbook -i hosts.ini playbook-myapp.yml
PLAY [myapp_development] *******************************************************
TASK [setup] *******************************************************************
ok: [myapp_development]
TASK [include_vars] ************************************************************
ok: [myapp_development]
TASK [include_vars] ************************************************************
ok: [myapp_development]
TASK [websauna.preflight : Fail if Ansible is old] *****************************
skipping: [myapp_development]
TASK [websauna.preflight : Fail if deploy_location not set] ********************
skipping: [myapp_development]
TASK [websauna.preflight : Fail if SSH agent forward is not in use] ************
skipping: [myapp_development]
TASK [websauna.preflight : Fail if site mode is not set or is something we don't feel confident about] ***
fatal: [myapp_development]: FAILED! => {"changed": false, "failed": true, "msg": "The Ansible server connection did not have SSH agent forwarding enabled or you have become_user\\:root in your playbook which you should not have"}
to retry, use: --limit @/Users/maz/src/ansible/websauna.ansible/playbook-myapp.retry
PLAY RECAP *********************************************************************
myapp_development : ok=3 changed=0 unreachable=0 failed=1
@mazz

mazz commented Feb 25, 2017

Copy link
Copy Markdown
Author

~/src/ansible/websauna.ansible (master ✔) ᐅ cat hosts.ini

myapp_development ansible_port=999 ansible_host=sidha.ca ansible_ssh_user=maz

@mazz

mazz commented Feb 25, 2017

Copy link
Copy Markdown
Author

~/src/ansible/websauna.ansible (master ✔) ᐅ cat playbook-myapp.yml

# Playbook which ramps up myapp tutorial site inside a Vagrant virtual machine

- hosts: myapp_development
  gather_facts: true

  # These need to be set up before reading default.yml - more variables are generated based on these
  vars:
    - package_name: myapp
    - site_id: myapp

    # Websocket is only needed to connect to IPython Notebook running on the server
    - websocket: off

    # Install Postfix for email out
#     - smtp: on

    # Is HTTPS traffic terminated by Nginx
    - ssl: off

    # Do we install Celery worker and beat to run background tasks
#     - celery: on

    # Is the site proxied by Cloudflare security service
    - cloudflare: off

    # Do we need to support New Relic monitoring
    - new_relic: off

    # Do we create Let's Encrypt HTTPS certificate for the site
    - letsenrypt: off

    # Do we enable Linux firewall
#     - firewall: on

    # Do we set up Duplicity backup tasks
    - backup: off

    - git_repository: mazz@github.com:mazz/myapp.git
    - git_branch: master
    - site_mode: development

    - ini_secrets_file: development-secrets.ini   # This file is generated by scaffold

    - server_name: myapp.example.com

    # Configured outbound domain for Postfix
#     - server_email_domain: example.com

    # System outgoing email address (cron others)
#     - server_email: no-reply@example.com

    # Receive messages from Cron and system scripts to this address
#     - notify_email: mikko@example.com

  pre_tasks:

    # Load default vars based on playbook.yml input
    - include_vars: default.yml
      tags: site, smtp, psql, uwsgi, nginx

    # Load default vars based on playbook.yml input
    - include_vars: secrets.yml
      tags: site, smtp, psql, uwsgi, nginx

  roles:

    # Sanity check
    - { role: websauna.preflight, tags: ['site'] }

    # Set up wsgi UNIX user
    - websauna.users

    # Needed to setup SSH auth socket for github/bitbucket
    - { role: websauna.ssh, tags: ['site'] }

    # Set up bash, etc. settings
#     - websauna.shell

    # Install fail2ban, optionally enable Linux firewall
#     - websauna.harden

    # Set up outgoing email with Postfix
#     - websauna.smtp

    # Build a local PostgreSQL server for your database
#     - { role: ANXS.postgresql, become: yes, become_user: root, tags: ['psql'] }

    # Set up Nginx web server for Internet facing traffic
#     - { role: Stouts.nginx, become: yes, become_user: root, tags: ['site'] }

    # Set up Redis server for session data
#     - { role: Stouts.redis, become: yes, become_user: root, tags: redis }

    # Set up updated Python 3.5 from deadsnakes repository
#     - { role: Stouts.python, become: yes, become_user: root }

    # Core login of setting up WSGI application in /srv/pyramid
    - { role: websauna.site, tags: ['site'] }  # Core site update logic

    # Finalize: send out email of job done, update motd
    - { role: websauna.postflight, tags: ['site'] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment