Using ftp-deploy with load-grunt-tasks causes errors - deployment

I've split my Gruntfile into multiple files using load-grunt-tasks but seem to get an error when using ftp-deploy. I've tried some different things, but I reason that the hyphen (-) in the "ftp-deploy" might cause problems.
I'm getting the following error:
Running "ftp-deploy:theme" (ftp-deploy) task
Verifying property ftp-deploy.theme exists in config...ERROR
>> Unable to process task.
Warning: Required config property "ftp-deploy.theme" missing. Use --force to continue.
When running:
grunt "ftp-deploy:theme" --verbose
My ftp-deploy script looks as follows:
# FTP DEPLOY
# -------
module.exports =
'ftp-deploy':
theme:
auth:
host: 'host.com'
port: 21
authKey: 'key'
src: 'drupal/sites/all/themes/theme_name'
dest: 'www/host.com/sites/all/themes/theme_name'
I've tried running it without incapsulating it inside the "theme:" object which works, but is essentially not what I want to do as I have different folders I want to transfer.
Any ideas to what a solution might be?

I found the answer myself.
'ftp-deploy':
Should of course not be included in the file.

Related

Why might I get expected: MappingNode was SequenceNode during kpt pkg get?

I am undertaking https://www.kubeflow.org/docs/distributions/gke/deploy/deploy-cli/ and at the stage bash ./pull-upstream.sh there is a problem and I have isolated it to a single command inside the scripts:
kpt pkg get https://github.com/zijianjoy/pipelines.git/manifests/kustomize/#upgradekpt upstream
When I run this command alone, I get the same error as when it runs in the script:
Package "upstream":
Fetching https://github.com/zijianjoy/pipelines#upgradekpt
From https://github.com/zijianjoy/pipelines
* branch upgradekpt -> FETCH_HEAD
Adding package "manifests/kustomize".
Fetched 1 package(s).
Error: /home/tester_user/gcp-blueprints/kubeflow/apps/pipelines/upstream/third-party/argo/upstream/manifests/namespace-install/overlays/argo-server-deployment.yaml: wrong Node Kind for expected: MappingNode was SequenceNode: value: {- op: add
path: /spec/template/spec/containers/0/args/-
value: --namespaced}
I made some mistakes following the script during the setup (that I think I corrected) so it could be something I did. It would be good to know why this error is happening even so for my general understanding.
I am on google cloud platform, in the command line prompt that comes built in to the web ui.

Ansible: conflicting action statements: group, tags

I have following code in on of roles:
- name: Create user group
group: name={{ user.group }} state=present
tags:
- user
When I run ansible-playbook -i localhost --ask-become-pass playbook.yml I catch an error:
ERROR! conflicting action statements: group, tags
The error appears to have been in '/home/user/spark/roles/base/tasks/main.yml': line 12, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Create user group
^ here
...
exception type: <class 'ansible.errors.AnsibleParserError'>
exception: conflicting action statements: group, tags
...
Full error log: https://www.pastiebin.com/59cb4faf9ae35
If I remove tags it runs without error.
It was compnow it is exception: unexpected parameter type in action: after I leave only name and tags. Full error log: pastiebin.com/59cb5b2996a10letely ok all the time but now it works like this without any identifiable reason. I tried to use previous working version of playbook (through git checkout ) but error exists anyway :(
I would be grateful for any hint on this.
P.S. I have fork of ansible playbook for Archlinux machine.
P.P.S.
ansible 2.4.0.0
config file = /home/user/spark/ansible.cfg
configured module search path = [u'/home/user/spark/library/ansible-aur']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.14 (default, Sep 20 2017, 01:25:59) [GCC 7.2.0]
Ansible aur:
[submodule "library/ansible-aur"]
path = library/ansible-aur
url = https://github.com/pigmonkey/ansible-aur.git
ansible.cfg
[defaults]
library = ./library/ansible-aur
UPD. If I remove group keyword like this:
- name: Create user group
tags:
- user
I catch an error: unexpected parameter type in action: after I leave only name and tags. Full error log: pastiebin.com/59cb5b2996a10
That's pretty funny story.
I have vim plugin that creates ctags tags for a project. And it created file named: spark/library/ansible-aur/tags.
It wasn't python file or something. It was just common ctags file.
I found that it was the root of all troubles by using pdb debugger with ansible code.
I've found one of error strings I saw: conflicting action statements in ansible code:
> /usr/lib/python2.7/site-packages/ansible/parsing/mod_args.py(293)parse()
-> raise AnsibleParserError("conflicting action statements: %s, %s" % (action, item), obj=self._task_ds)
And injected pdb.set_trace() there.
Then I make some study:
(Pdb) item
u'tags'
(Pdb) item in module_loader
True
(Pdb) module_loader.find_plugin(item)
u'/home/user/spark/library/ansible-aur/tags'
Last line was kind of hint. After deleting that tags file everything was completely ok.
Corresponding bug report: https://github.com/ansible/ansible/issues/31070

How can I hide skipped tasks output in Ansible

I have Ansible role, for example
---
- name: Deploy app1
include: deploy-app1.yml
when: 'deploy_project == "{{app1}}"'
- name: Deploy app2
include: deploy-app2.yml
when: 'deploy_project == "{{app2}}"'
But I deploy only one app in one role call. When I deploy several apps, I call role several times. But every time there is a lot of skipped tasks output (from tasks which do not pass condition), which I do not want to see. How can I avoid it?
I'm assuming you don't want to see the skipped tasks in the output while running Ansible.
Set this to false in the ansible.cfg file.
display_skipped_hosts = false
Note. It will still output the name of the task although it will not display "skipped" anymore.
UPDATE: by the way you need to make sure ansible.cfg is in the current working directory.
Taken from the ansible.cfg file.
ansible will read ANSIBLE_CONFIG,
ansible.cfg in the current working directory, .ansible.cfg in
the home directory or /etc/ansible/ansible.cfg, whichever it
finds first.
So ensure you are setting display_skipped_hosts = false in the right ansible.cfg file.
Let me know how you go
Since ansible 2.4, a callback plugin name full_skip was added to suppress the skipping of task names and skipping keyword in the ansible output. You can try the below ansible configuration:
[defaults]
stdout_callback = full_skip
Ansible allows you to control its output by using custom callbacks.
In this case you can simply use the skippy callback which will not output anything on a skipped task.
That said, skippy is now deprecated and will be removed in ansible v2.11.
If you don't mind losing colours you can elide the skipped tasks by piping the output through sed:
ansible-playbook whatever.yml | sed -nr '/^TASK/{h;n;/^skipping:/{n;b};H;x};p'
If you are using roles, you can use when to cancel the include in main.yml
# roles/myrole/tasks/main.yml
- include: somefile.yml
when: somevar is defined
# roles/myrole/tasks/somefile.yml
- name: this task will only run (and be seen in the output) if somevar is defined
debug:
msg: "Hello World"

Error in Glance_image[cirros] : change from absent to present failed: Command: ... has been running for more then 20 seconds

I am running packstack.
Error: /Stage[main]/Main/Glance_image[cirros]/ensure: change from
absent to pres
ent failed: Command: 'openstack ["image", "create", "--format",
"shell", ["cirros", "--public", "--container-format=bare", "--disk-format=qcow2", "--copy-from=http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img"]]' has been running for more then 20 seconds!
I am having this error, I can wget it though, so I can perfectly reach it. Can someone help me resolving this? As a workaround I tried it manually, but I am really new to centos and Openstack, so I don't know much. I tried :
openstack image create --format shell cirros --public --container-format=bare --disk-format=qcow2 --copy-from=http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
I got Missing parameter(s):
Set a username with --os-username, OS_USERNAME, or auth.username Set
an authentication URL, with --os-auth-url, OS_AUTH_URL or
auth.auth_url Set a scope, such as a project or domain, set a project
scope with --os-project-
name, OS_PROJECT_NAME or auth.project_name, set a domain scope with
--os-domain-name, OS_DOMAIN_NAME or auth.domain_name
What should I add to the above command? Will it be able to solve my problem? If not what is the right way to solve the problem?
Solved it by replacing
--copy-from=http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img to point --copy-from=<local path>
But didn't got why the original command not working even when I can wget it.

capistrano upload! thinks ~ referenced local directory is on remote server

So every example I've looked up indicates this is how one is supposed to do it but I think I may have found a bug unless there's another way to do this.
I'm using upload! to upload assets to a remote list of servers. The task looks like this:
desc "Upload grunt compiled css/js."
task :upload_assets do
on roles(:all) do
%w{/htdocs/css /htdocs/js}.each do |asset|
upload! "#{fetch(:local_path) + asset}", "#{release_path.to_s + '/' + asset}", recursive: true
end
end
end
If local_path is defined as an absolute path such as:
set :local_path:, '/home/dcmbrown/projects/ABC'
This works fine. However if I do the following:
set :local_path:, '~/projects/ABC'
I end up getting the error:
The deploy has failed with an error: Exception while executing on ec2-54-23-88-125.us-west-2.compute.amazon.com: No such file or directory - ~/projects/ABC/htdocs/css
It's not a ' vs " issue as I've tried both (and I didn't think capistrano paid attention to that anyway).
Is this a bug? Is there a work around? Am I just doing it wrong?
I ended up discovering the best way to do this is to actually use path expansion! (headsmack)
irb> File.expand_path('~dcmbrown/projects/ABC')
=> "/home/dcmbrown/projects/ABC"
Of course what I'd like is to do automatic path expansion but you can't have everything. I think I was mostly dumbstruck that it didn't automatically; so much so I spent a couple of hours trying to figure out why it didn't work and ended up wasting time asking here. :(
I don't think the error is coming from the remote server, it just looks like it since it's running that upload command in the context of a deploy.
I just created a single cap task to just do an upload using the "~" character and it also fails with
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy#XXX: No such file or directory # rb_file_s_stat - ~/Projects/testapp/public/404.html
It appears to be a Ruby issue not Capistrano as this also fails in a Ruby console
~/Projects/testapp $ irb
2.2.2 :003 > File.stat('~/Projects/testapp/public/404.html')
Errno::ENOENT: No such file or directory # rb_file_s_stat - ~/Projects/testapp/public/404.html
from (irb):3:in `stat'
from (irb):3
from /Users/supairish/.rvm/rubies/ruby-2.2.2/bin/irb:11:in `<main>'