I agree with @40Q and @MWDelaney that this bit of the error message …
vault_wordpress_sites[item.key].env) }}: 'dict object' has no attribute u'xxx.xx.xx.xxx'
… is an indication that this line in group_vars/staging/vault.yml
doesn’t match this line in group_vars/staging/wordpress_sites.yml
. Could you confirm that those exact lines match in your group_vars/staging
files?
Although you can make those two lines IP addresses, I believe you’ll make your life easier if you make those lines some sort of recognizable name for the site because the name is used in file paths and logs created on the server. A name would be more identifiable and the IP address may be a little more likely to change than a name. Most people use the domain name (recommended) but you could just use cgw
, like this:
# group_vars/staging/wordpress_sites.yml
wordpress_sites:
cgw:
site_hosts:
- canonical: staging.cgw.com
etc.
# group_vars/staging/vault.yml
vault_wordpress_sites:
cgw:
env:
db_password: example_dbpassword
etc.
Aside from occurring on the same task, the other error is not related. The other error message mentioned a template error
, which was the root of the problem, but your error does not.
Do you have the same IP address in hosts/production
as you do in hosts/staging
? If so there is a slight chance this could be the cause of the error you see (but I doubt it).
It is not recommended to put the staging and production sites on the same server, so the IP should differ between hosts/production
and hosts/staging
.