我有我的目录结构
??? digitalocean
??? README.md
??? play.yml
??? roles
??? bootstrap_server
? ??? tasks
? ??? main.yml
??? create_new_user
? ??? tasks
? ??? main.yml
??? update
? ??? tasks
? ??? main.yml
??? vimserver
??? files
? ??? vimrc_server
??? tasks
??? main.yml
Run Code Online (Sandbox Code Playgroud)
当我在角色下创建用户时create_new_user,我将用户名硬编码为
---
- name: Creating a user named username on the specified web server.
user:
name: username
state: present
shell: /bin/bash
groups: admin
generate_ssh_key: yes
ssh_key_bits: 2048
ssh_key_file: .ssh/id_rsa
- name: Copy .ssh/id_rsa from …Run Code Online (Sandbox Code Playgroud) 我正在练习不同的方法来为结构变量赋值.但是,当我尝试这个时,我得到了一些垃圾价值.这是代码.
#include<iostream>
using namespace std ;
struct Distance{
int feet ;
int inches;
};
void get_val(Distance );
void disp(Distance);
int main(){
Distance l, m ; //Objects
get_val(l);
get_val(m);
disp(l);
disp(m);
return 0 ;
}
void get_val(Distance length){
cout<<"\nEnter Length "
<<"\nFeet : ";
cin>>length.feet;
cout<<"\nInches : ";
cin>>length.inches;
}
void disp(Distance length){
cout<<"\nLength : \n"
<<"Feet : "<<length.feet
<<"\nInches : "<<length.inches ;
}
Run Code Online (Sandbox Code Playgroud)
为什么我将垃圾值作为输出?
我正在尝试使用以下命令更改运行 centos 的 docker 容器的主机名
hostnamectl set-hostname test.ovirt.org
Run Code Online (Sandbox Code Playgroud)
但它给了我一个回溯
Could not set property: Failed to execute program /lib64/dbus-1/dbus-daemon-launch-helper: Success
Run Code Online (Sandbox Code Playgroud)
退出代码为 1。
这是相关的 travis-CI 构建回溯
编辑:
我正在运行命令来更改 Travis 构建中 ansible 任务内的主机名。使用交互模式编辑主机名不是一个选项。
我试图为我的S3存储桶创建一个远程后端。
provider "aws" {
version = "1.36.0"
profile = "tasdik"
region = "ap-south-1"
}
terraform {
backend "s3" {
bucket = "ops-bucket"
key = "aws/ap-south-1/homelab/s3/terraform.tfstate"
region = "ap-south-1"
}
}
resource "aws_s3_bucket" "ops-bucket" {
bucket = "ops-bucket"
acl = "private"
versioning {
enabled = true
}
lifecycle {
prevent_destroy = true
}
tags {
Name = "ops-bucket"
Environmet = "devel"
}
}
Run Code Online (Sandbox Code Playgroud)
我尚未执行任何操作,到目前为止,该存储桶尚不存在。因此,terraform要求我做一个init。但是当我尝试这样做时,我得到了
$ terraform init
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use …Run Code Online (Sandbox Code Playgroud) 我正在浏览谷歌的python介绍并且遇到了s * 3比在类型的s + s + s地方更快的声明.sstring
出现这种情况的原因是什么?
我用Google搜索并发现python中的s + ='a'或s = s +'a'更快.但这没有帮助
尝试运行命令时,我得到了这个奇怪的letsencrypt错误
$ certbot certonly --standalone --email example@gmail.com --agree-tos -n -d trumporate.com,www.trumporate.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for trumporate.com
tls-sni-01 challenge for www.trumporate.com
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. trumporate.com (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Timeout, www.trumporate.com (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Timeout
IMPORTANT NOTES:
- …Run Code Online (Sandbox Code Playgroud) us-west1-a我正在尝试使用as区域中storage-class的terraform 创建一个 gcs 存储桶REGIONAL。但这样做时我收到此错误
* google_storage_bucket.terraform-state: 1 error(s) occurred:
* google_storage_bucket.terraform-state: googleapi: Error 400: The combination of locationConstraint and storageClass you provided is not supported for your project, invalid
Run Code Online (Sandbox Code Playgroud)
这是.tf我现在拥有的文件
resource "google_storage_bucket" "terraform-state" {
name = "terraform-state"
storage_class = "${var.storage-class}"
}
provider "google" {
credentials = "${file("${path.module}/../credentials/account.json")}"
project = "${var.project-name}"
region = "${var.region}"
}
variable "region" {
default = "us-west1" # Oregon
}
variable "project-name" {
default = "my-project"
}
variable "location" { …Run Code Online (Sandbox Code Playgroud) #include<iostream>
using namespace std ;
class Foo{
int a , b ;
public:
Foo(int x, int y){
a = x ;
b = y ;
}
Foo(Foo& obj){
a = obj.a ;
b = obj.b ;
}
};
int main(){
Foo obj(2,3) ;
Foo obj1(obj) ;
Foo obj2 = obj ;
}
Run Code Online (Sandbox Code Playgroud)
如果我是正确的,都Foo obj2 = obj ;和Foo obj1(obj) ;调用拷贝构造函数.
使用其中一个的优点和缺点是什么?
我有类似的东西
stud_1 = {'stud_2' : 1, 'stud_3' : 3, 'stud_4' : 2,'stud_5' : 5,'stud_6' : 1,'stud_7' : 3,'stud_8' : 4,'stud_9' : 3}
stud_2 = {'stud_1' : 3, 'stud_3' : 2, 'stud_4' : 4,'stud_5' : 2,'stud_6' : 1,'stud_7' : 5,'stud_8' : 1,'stud_9' : 2}
stud_3 = {'stud_1' : 1, 'stud_2' : 5, 'stud_4' : 3,'stud_5' : 5,'stud_6' : 5,'stud_7' : 2,'stud_8' : 3,'stud_9' : 5}
stud_4 = {'stud_1' : 4, 'stud_2' : 3, 'stud_3' : 2,'stud_5' : 1,'stud_6' : 5,'stud_7' : …Run Code Online (Sandbox Code Playgroud) 为什么这个论点不是通过价值传递的?
当我尝试它时,我的编译器只给了我一条消息,说"你可能意味着" Foo(const Foo&).
这是什么原因?
c++ ×3
ansible ×2
python ×2
terraform ×2
amazon-ec2 ×1
centos ×1
constructor ×1
dictionary ×1
docker ×1
function ×1
lets-encrypt ×1
nginx ×1
operators ×1
slice ×1
string ×1
structure ×1
travis-ci ×1
ubuntu ×1