sequentech / deployment-tool

Sequent deployment ansible scripts
GNU Affero General Public License v3.0
14 stars 21 forks source link

[NEXT] AgoraGui, config setup fail in deployment system #66

Open Hilfe opened 8 years ago

Hilfe commented 8 years ago

Provisoning Agora server show the next fail:

TASK: [AgoraGui, config setup] *** fatal: [default] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'dict object' has no attribute 'name'", 'failed': True} fatal: [default] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'dict object' has no attribute 'name'", 'failed': True} FATAL: all hosts have already failed -- aborting

nfortea commented 7 years ago

I have a similar error when execute: time sudo ansible-playbook -i inventory playbook.yml

I received:

TASK [AgoraElections, Default conf] ********************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'share_social'"}

It's difficult to me find where is calling attribute 'share_social'

nfortea commented 7 years ago

When I execute: time sudo ansible-playbook -i inventory playbook.yml -vvv I obtain:

TASK [AgoraElections, Default conf] ********************************************
task path: /home/agora/agora-dev-box/agora-elections/main.yml:34
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"dest": "/home/agoraelections/agora-elections/conf/application.local.conf", "mode": "0644", "owner": "agoraelections", "src": "agora-elections/templates/application.local.conf"}, "module_name": "template"}, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'share_social'"}

Looking in main.yml, line 34

# Config files
 - name: AgoraElections, Default conf
   sudo: true
   sudo_user: agoraelections
   template: src=agora-elections/templates/application.local.conf dest=/home/agoraelections/agora-elections/conf/application.local.conf owner="agoraelections" mode=0644

Destination file /home/agoraelections/agora-elections/conf/application.local.conf dont' exist yet. However agora-elections/templates/application.local.conf in line 107

 # social networks buttons configuration
share_social {
  allow_edit = {% if config.agora_gui.share_social.allow_edit %}true{% else %}    false{% endif %},
  default = [
      {% for button in config.agora_gui.share_social.default %}
      {
        network = "{{ button.network }}",
        button_text = "{{ button.button_text }}",
        social_message = "{{ button.social_message }}"
      }{% if not loop.last %},{% endif %}
      {% endfor %}
    ]
}

Some ideas?

Findeton commented 7 years ago

I'm guessing the issue is with your config.yml. Specifically, it looks like it's missing 'share_social' dict, which should be under config.agora_gui. Look, for example, file config.yml on lines 452 to 461:

    # social networks buttons configuration
    share_social:
      allow_edit: true
      default:
        - network: 'Twitter'
          button_text: ''
          social_message: 'I have just voted in election __URL__, you can too! #nvotes'
        - network: 'Facebook'
          button_text: ''
          social_message: '__URL__'

Perhaps you have moved those lines and they are now not under agora_gui or you have removed them, or perhaps you have the wrong indentation (which would imply that share_social is not under agora_gui anymore)

nfortea commented 7 years ago

The closest thing that i found in config.yml was on lines 423-430 on agora_gui:

423     # social networks footer links
424     social:
425       facebook: 'https://facebook.com/nvotes/'
426       twitter: 'https://twitter.com/nvotes'
427       twitterHandle: 'nvotes'
428       googleplus: 'https://plus.google.com/101939665794445172389/posts'
429       youtube: 'https://www.youtube.com/results?search_query=nvotes'
430       github: 'https://github.com/nvotes/'

I got the same after executing a git pull.

Are we taking about a copy of doc/production/config.master.yml?

nfortea commented 7 years ago

I resolve coping lines from doc/production/config.auth.yml:

    # social networks buttons configuration
    share_social:
      allow_edit: true
      default:
        - network: 'Twitter'
          button_text: ''
          social_message: 'I have just voted in election https://go.nvotes.com, you can too! #nvotes'

Thanks